if clause for a nonscalar operator

4 ビュー (過去 30 日間)
shirin mhd
shirin mhd 2022 年 8 月 2 日
コメント済み: Abderrahim. B 2022 年 8 月 2 日
Hi everyone
I have this code:
p=[];
if p==[]
disp('hello')
else
disp('bye')
end
and I expect this answer:
>> test
hello
but I receive this answer:
>> test
bye
how can i solve this problem???

採用された回答

Abderrahim. B
Abderrahim. B 2022 年 8 月 2 日
If I understood correctly:
p=[];
if ~isscalar(p)
disp('hello')
else
disp('bye')
end
hello
  2 件のコメント
shirin mhd
shirin mhd 2022 年 8 月 2 日
Thank you so much.
Abderrahim. B
Abderrahim. B 2022 年 8 月 2 日
My pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by