nansum for double or single -> why error?
古いコメントを表示
hi :)
can please someone explain to me how I can use nansum for a vector? I always get this error:
Undefined function 'nansum' for input arguments of type 'single'.
same for double >> in what datatype do I have to transform the data?
Thx for ur help.
採用された回答
その他の回答 (1 件)
Steven Lord
2015 年 7 月 28 日
Marco, since you're using release R2015a (according to your comment on Cedric's answer) you can use SUM with the appropriate nanflag input argument instead of NANSUM.
x = [1:10 NaN];
sum(x, 'omitnan')
3 件のコメント
Cedric
2015 年 7 月 28 日
I had never realized that this flag was implemented, thank you for the update!
Steven Lord
2015 年 7 月 28 日
Not only does SUM accept this flag, but so do a number of the other basic statistical calculation functions. For a full list, see the second item in the Mathematics section of the release R2015a Release Notes for MATLAB.
Cedric
2015 年 7 月 28 日
Thank you Steven! I obviously don't spend enough time reading release notes.
カテゴリ
ヘルプ センター および File Exchange で Large Files and Big Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!