help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sumskipnan(nan) = 0 ?


From: GAIL
Subject: Re: sumskipnan(nan) = 0 ?
Date: Mon, 10 Sep 2007 17:44:34 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060918 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666

On 09/10/2007 05:17 PM, James Sherman Jr. wrote:
function y = mysumskipnan(x)

nanIndices = isnan(x);

if sum(nanIndices) == length(x),
   y = NaN;
else
   y = sum(x(~nanIndices));
end

return

Yes, that is what I did. And again, I see no other way how a summation can 
usefully be defined in a missing value context (apart from the 'classical' sum 
behavior).

Thanks,

G.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]