Test an Entire Array
Use the islogical function to test whether A is logical.islogical(A)ans =1The result is logical 1 (true).Use the class function to display a string with the class name of A.class(A)ans =logicalThe result confirms that A is logical.Test Each Array Element
Create a cell array, C, and use the 'islogical' option of the cellfun function to
identify which cells contain logical values.C = {1, 0, true, false, pi, A};
cellfun('islogical',C)ans =0 0 1 1 0 1The result is a logical array of the same size as C.To test each element in a numeric matrix, use the arrayfun function.arrayfun(@islogical,A)ans =1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 15 The Logical Class