Error: Indexing with parentheses '()' must appear as the last operation of a valid indexing expression??
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Naruto
am 10 Nov. 2020
Bearbeitet: Naruto
am 10 Nov. 2020
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 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 10 Nov. 2020
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!