The end operator must be used within an array index expression
조회 수: 21 (최근 30일)
이전 댓글 표시
How to fix this error:
The end operator must be used within an array index expression.
Error in .... (line 17)
shot = shot(101:end,1);
댓글 수: 7
채택된 답변
Steven Lord
2020년 9월 15일
The identifiers shot (all lower-case) and Shot (first letter capitalized) are two different things in MATLAB. Did you mean to index into Shot instead of shot?
댓글 수: 3
MUNEEB AHMAD
2022년 5월 18일
편집: MUNEEB AHMAD
2022년 5월 18일
The end operator must be used within an array index expression.
Error in test2 (line 5)
BER(i)=ber(end,1);
This is the code.
gama_dB=0:0.5:10;
for i=1:length(gama_dB)
g_dB=gama_dB(i);
sim('Bpsk2')
BER(i)=ber(end,1);
end
Why is this error coming here? plese help.
Steven Lord
2022년 5월 18일
Nothing in your code defines a variable named ber. Do you have a function named ber accessible to MATLAB? If so that last command inside the for statement tries to call that function with end and 1 as the two inputs. But MATLAB doesn't know how to interpret end in that context and so throws an error.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!