if clause for a nonscalar operator
    3 views (last 30 days)
  
       Show older comments
    
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???
0 Comments
Accepted Answer
  Abderrahim. B
      
 on 2 Aug 2022
        If I understood correctly:
p=[];
if ~isscalar(p)
    disp('hello')
else 
    disp('bye')
end
More Answers (0)
See Also
Categories
				Find more on Logical 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!
