facing error to execute
1 回表示 (過去 30 日間)
古いコメントを表示
a=[1 2 3 4];
b = vsum(a);
disp(b);
function y = vsum(x)
y = sum(x,'all');
end
I am facing below error
Error using sum
Invalid option. Option must be 'double', 'native', 'default', 'omitnan' or 'includenan'.
Error in vecadd>vsum (line 5)
y = sum(x,'all');
Error in vecadd (line 2)
b = vsum(a);
0 件のコメント
回答 (1 件)
Image Analyst
2022 年 11 月 11 日
I don't believe the 'all' option had been introduced in your r2016b version. Can you upgrade to the latest version. Or else do
y = sum(x(:));
4 件のコメント
Image Analyst
2022 年 11 月 11 日
Why did you put a comma after the x? I did not say to do that.
You did
y = sum(x,(:));
while I said to do
y = sum(x(:));
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!