operators must be convertible to logical scalar values
    4 views (last 30 days)
  
       Show older comments
    
    Riccardo Tronconi
 on 21 Jul 2021
  
    
    
    
    
    Answered: Walter Roberson
      
      
 on 21 Jul 2021
            Dear guys! I'm struggling to solve this dummy issue. Here it is my code: 
if Inan> Istart && (Inan<Iend || isempty(Iend)==1)
    Iend=Inan - 1; 
end 
the error is : Operands to the logical and (&&) and or (||) operators must be convertible to logical scalar values.
Thanks in advance!
0 Comments
Accepted Answer
  Walter Roberson
      
      
 on 21 Jul 2021
        If Iend is empty then Inan<Iend is empty and you would be trying to use (empty || something) but operands for || must be scalars.
You should test for empty before testing <
Note: you can use just isempty(Iend) instead of isempty(Iend)==1
0 Comments
More Answers (0)
See Also
Categories
				Find more on Characters and Strings 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!
