Non-scalars are not supported in IF or WHILE statements
2 views (last 30 days)
Show older comments
BARAN Özbakr
on 3 May 2014
Commented: Azzi Abdelmalek
on 3 May 2014
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 Comments
Accepted Answer
Azzi Abdelmalek
on 3 May 2014
Edited: Azzi Abdelmalek
on 3 May 2014
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)
1 Comment
More Answers (0)
See Also
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!