Posts

Showing posts with the label logical

How to check the type of a variable is logical in MatLab? - islogical -- MatLab

 How to check the type of a variable is logical in MatLab? - islogical -- MatLab How to check the type of a variable is logical in MatLab? [Ans] islogical [description] <answer>=islogical(<b1>) When <b1> is a logical, it returns true. Otherwise, it returns false. [NOTE] Great Importance!!! Please pay a lot of attention on it. (1) islogical(1) and islogical(2) will return false because 2 is considered as double type. (2) islogical(5<7) will return true because 5<7 is a relational operator. more details on: logical Convert numeric values to logicals - MATLAB logical (mathworks.com) islogical Determine if input is logical array - MATLAB islogical (mathworks.com) code clear clc b1=logical(1) islogical(b1) b2=logical(0) islogical(b2) b3=logical(2) islogical(b3) b4=logical([0 1 0 1 2 3]) islogical(b4) b5=logical( 'A' ) islogical(b5) b6=logical([ 'A' 0 0 'B' ]) islogical(b6) %{ %compiler error %because there is not conversion between struct and ...