Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8821133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:46:40+00:00 2026-06-14T05:46:40+00:00

I have an 950000×1 array of values, for example [1e15 2.5e12 …etc] . but

  • 0

I have an 950000x1 array of values, for example [1e15 2.5e12 ...etc]. but when I do the following to get the average value, I get values as NaN.

avg=mean(g1)

I am not able to understand why I am getting this error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:46:41+00:00Added an answer on June 14, 2026 at 5:46 am

    The following code runs fine on my machine (Core i7, 16GB RAM, Linux Mint v12, Matlab 2012b):

    T = 1e9;
    Vec = ones(T, 1) * 1e200;
    M = mean(Vec);
    

    This suggests to me your array of values contains an NaN somewhere. Note, even if your array contained numbers larger than double floating point can handle (ie on the order of 1e320 or thereabouts), then the mean function will return Inf, not NaN.

    Try any(isnan(Vec)) over your array. If it returns a 1, then you’ll know it contains an NaN. If it does, then the following code will remove the NaNs.

    Vec(isnan(Vec)) = [];
    

    If you think this has resolved your query, then feel free to click the tick mark next to my answer. Cheers!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been looking for an array type with the following characteristics in Erlang.
Let's suppose I have the following line in a CSV file (I removed the
I have the following (Decimal('1.000'), Decimal('419.760000'), Decimal('4.197600000'), Decimal('423.957600000')) (Decimal('1.000'), Decimal('62.370000'), Decimal('0.623700000'), Decimal('62.993700000')) (Decimal('2.000'), Decimal('7.920000'),
I have a small problem when I get old messages from my database. I
Say I have any of the following numbers: 230957 or 83487 or 4785 What
I have the following data: yvar <- c(1:150) replication <- c( rep(c(rep(1, 10), rep(2,10),
I have the following code in AS3: var str:String = '<TEXTFORMAT LEADING=2><P ALIGN=LEFT><FONT FACE=Arial
So I have the following code: angle = progbm.progress * 30; NSLog(@%d,%f, angle, progbm.progress);
I have a list of timestamps in %H:%M:%S format. For example 09:50:08.650000 09:50:08.665000 09:50:08.820000
I have number like this in my html <div class=number>950000</div> and I want jQuery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.