Non-scalars are not supported in IF or WHILE statements
3 次查看(过去 30 天)
显示 更早的评论
if true
[min_bb,idxb]=min(errorb(:,:,ii));
[linebb,codexbb]=ind2sub(size(errorb),idxb); %find minumum location per_phase
end
this my code, I am trying to use "codexbb" and "linebb" in IF statement like
if(linebb==2)
but, matlab gives an erros and said "Non-scalars are not supported in IF or WHILE statements". On the other way, when I checked its dimensions, it says 1 1. How can I solve the problem ?
King Regard....
0 个评论
采纳的回答
Azzi Abdelmalek
2014-5-3
编辑:Azzi Abdelmalek
2014-5-3
linebb is a vector, what do you want to test? for example if
linebb=[1 2 3]
your are trying to compare linebb to 2,
linebb==2
the result is
0 1 0
you have to explain what you want, if you want to test if 2 belong to linebb you can do it by
ismember(2,linebb)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!