Non-scalars are not supported in IF or WHILE statements
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
BARAN Özbakr
el 3 de Mayo de 2014
Comentada: Azzi Abdelmalek
el 3 de Mayo de 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 comentarios
Respuesta aceptada
Azzi Abdelmalek
el 3 de Mayo de 2014
Editada: Azzi Abdelmalek
el 3 de Mayo de 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 comentario
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!