problem with sum command
조회 수: 13 (최근 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!