Error: Indexing with parentheses '()' must appear as the last operation of a valid indexing expression??
4 次查看(过去 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 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!