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일

1 개 추천

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개)

카테고리

질문:

2022년 8월 2일

댓글:

2022년 8월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by