Error: Indexing with parentheses '()' must appear as the last operation of a valid indexing expression??
조회 수: 2 (최근 30일)
이전 댓글 표시
Why does the following for loop produce the error "Indexing with parentheses '()' must appear as the last operation of a valid indexing expression"?
data matrix (1000x4)
Pass = [];
for i = 1:size(xt)
for j = 1:size(x)
if (sqrt((x(j,1)-xt(i,1)^2)+(y(j,1)-yt(i,1))^2))<2
if (ismember(j,Pass)(1)==0)
Pass = [Pass j];
end
end
end
end
disp(Pass);
댓글 수: 0
채택된 답변
Cris LaPierre
2020년 11월 10일
What do you want this line to do?
ismember(j,Pass)(1)==0
The (1) is causing the problem. Did you intend to do this instead?
ismember(j,Pass)==0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!