Hi,
By using sum function I want to sum up the values in a vector, the results should be 14,532,000 but I get NaN. How can I avoid to get NaN? How can I get 14,532,000 instead of NaN. The vector can be shown, however I cannot get result of summation.
Thank you in advance.
Regards,
Ozge
|
|
0
|
|
|
|
Reply
|
Ozge
|
4/29/2010 5:50:21 AM |
|
x = [4 5 6 NaN 10 3];
sum(x(~isnan(x))) % Compare to sum(x)
|
|
0
|
|
|
|
Reply
|
Matt
|
4/29/2010 6:05:23 AM
|
|
"Ozge Taskan" <lordgy@yahoo.com> wrote in message <hrb6mt$5jn$1@fred.mathworks.com>...
> Hi,
>
> By using sum function I want to sum up the values in a vector, the results should be 14,532,000 but I get NaN. How can I avoid to get NaN? How can I get 14,532,000 instead of NaN. The vector can be shown, however I cannot get result of summation.
>
> Thank you in advance.
>
> Regards,
>
> Ozge
in addition - and - if(f) you own the stats tbx
help nanmean; % <- and siblings...
us
|
|
0
|
|
|
|
Reply
|
us
|
4/29/2010 6:29:31 AM
|
|
"Matt Fig" <spamanon@yahoo.com> wrote in message <hrb7j3$112$1@fred.mathworks.com>...
> x = [4 5 6 NaN 10 3];
> sum(x(~isnan(x))) % Compare to sum(x)
Hi,
Thank you for your interest. But I have no NaN value in my vector. I get NaN as a result, however when I export my vector to Excel and sum the values in the vector I get 14,532,000. The point that I do not understand is why I get NaN instead of 14,532,000 from Matlab. I want to do something and get the exact result instead of NaN. Thank you.
Regards,
Ozge
|
|
0
|
|
|
|
Reply
|
Ozge
|
4/29/2010 6:32:09 AM
|
|
O.k., so what do you get for this:
any(~isfinite(x)) % replace x with your vector.
|
|
0
|
|
|
|
Reply
|
Matt
|
4/29/2010 7:00:23 AM
|
|
|
4 Replies
517 Views
(page loaded in 2.352 seconds)
Similiar Articles: griddata - NaN - comp.soft-sys.matlabGriddata gives you a NaN for any such points. So, in a sense, you are doing ... observation is 3d then converted to my grid point by interp2 ... how to avoid NaN ... find nan in a cell array - comp.soft-sys.matlabSum of a cell - comp.soft-sys.matlab how to avoid NaN - comp.soft-sys.matlab How ... National Action Network | No Justice, No ... Help: array iterations outcoming is NaN ... 64-bit byteswapping and legacy programs - comp.lang.fortran ...how to create a custom bit pattern in simulink - comp.soft-sys ... how to avoid NaN - comp.soft-sys.matlab comp.soft-sys.matlab - page 403... snapshot of video in simulink ... how can you restart CUMSUM - comp.soft-sys.matlabI want to avoid doing this with loops). How can you do this? the sample data is ... MEX the function, then use it like this: tmp = x(:,2); tmp(~x(:,1)) = NaN; tmp ... Using GRPSTATS to compute statistics on multiple variables by ...Using GRPSTATS to compute statistics on multiple variables by ..... to avoid NaN - comp.soft-sys.matlab | Computer Group Hi, By using ... Proc means - comp.soft-sys.sas ... Error in SVD when estimating GARCH model using garchfit - comp ...Error using ==> svd Input to SVD must not contain NaN or Inf. Error in ==> pinv ... Dear all, I'd be really happy if anyone could help me out with some idea how to prevent ... Computing adjusted means via Proc SurveyReg - comp.soft-sys.sas ...Using GRPSTATS to compute statistics on multiple variables by ..... to avoid NaN - comp.soft-sys.matlab | Computer Group Hi, By using ... Proc means - comp.soft-sys.sas ... Large matrix handling - comp.soft-sys.matlabHow do you find all the 0's in a matrix and replace with NaN ... How do you find all ... How to avoid Out of Memory Errors when dealing with a large XML ... So I watched the ... How to if-else in 1 line in matlab like C --- x = (d < D0)?20:30 ...Well, actually, the above code is that I would like to avoid divided by zeros. ... how to assign a NaN? - comp.lang.fortran NaN is nice because somebody else did the ... How to shift the values of x axis from position of x axis to other ...... Min_Subscript] [, /ABSOLUTE] [, DIMENSION=3Dvalue] [, MAX=3Dvariable] [, /NAN ... Position of xtick marks - comp.soft-sys.matlab Axis appearance: avoid tick ... How to avoid NaN - labviewlabview, How to avoid NaN . comp.lang.labview - Labview Software Discussion Group. R help - how to avoid NaN in optim() - Nabble - Free forum & other ...> On Fri, Oct 1, 2010 at 12:30 AM, Ravi Varadhan <[hidden email]> wrote: > >> I forgot to mention: >> >> You actually got correct results with using optim and `CG'. 7/23/2012 1:57:23 AM
|