Info

この質問は閉じられています。 編集または回答するには再度開いてください。

If else statement problem

1 回表示 (過去 30 日間)
MUHAMMAD NAZMI ZAINAL AZALI
MUHAMMAD NAZMI ZAINAL AZALI 2019 年 12 月 13 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi, im having issues with if else statement which the value of 0 show failed.jpg. But it supposed to be show passed.jpg.
if (idx <= 4)
imshow('Passed.jpg')
else
imshow('Failed.jpg')
end

回答 (1 件)

Guillaume
Guillaume 2019 年 12 月 13 日
I would suspect that the reason you always get 'failed' is because your idx is not scalar, in which case you need to loop of each element of your idx array before testing them with your if.
If that's not the issue then give attach your m code and a mat file with the necessary input to run it.

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by