problem with sum command
1 回表示 (過去 30 日間)
古いコメントを表示
when i use sum(a), while the elements of 'a' are not integer, i got this error:Subscript indices must either be real positive integers or logicals. what is the problem?
0 件のコメント
回答 (1 件)
Wayne King
2013 年 12 月 26 日
編集済み: Wayne King
2013 年 12 月 26 日
You must have a variable in your workspace called sum, which is a bad idea.
Make sure that your program or script does not create a variable called sum.
If you enter,
>>which sum
You'll see
sum is a variable.
Enter
clearvars sum
Then try to use sum() again. You should avoid creating variables that have the same name as functions you want to use.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!