Index exceeds matrix dimensions
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello, I noticed that Matlab was returning the error "Index exceeds matrix dimensions" when running this default script:
%%Sum of Vector Elements
% Create a vector and compute the sum of its elements.
% Copyright 2015 The MathWorks, Inc.
A = 1:10;
S = sum(A);
How can I fix that? Thanks in advance!
채택된 답변
Star Strider
2016년 10월 22일
In your Command Window, type:
which sum -all
If the first on the list of results is:
sum is a variable.
you have your answer.
The ‘fix’ is to rename your ‘sum’ variable to something else that makes sends in the context of your code, for example ‘sum_v’.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!