How to do sum of array having decimal value?
3 ビュー (過去 30 日間)
古いコメントを表示
For example: I have an array h = [ 0.2 0.54 0.75 1.33]; and I want to sum of the array h from second value to the end. sum(h(2:end);
But this will give an error Subscript indices must either be real positive integers or
logicals
Help me how to address or remove this error.
Thanks
0 件のコメント
回答 (1 件)
madhan ravi
2020 年 10 月 3 日
編集済み: madhan ravi
2020 年 10 月 3 日
clear sum
h = [ 0.2 0.54 0.75 1.33 ];
sum(h(2 : end))
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!