all

  • all(A,<dimvec>)
    • For each combination of indices in the dimensions not named in dimvec, returns logical true 1 iff every element along the dimensions named in dimvec is generalized-true
      • dimvec defaults to the first non-singleton dimension
    • Returns logical true when A is an empty array
  • all(A,'all') tests every element of A and returns logical true iff all are true
    • Equivalent to all(A(:))

Example

>> A = [0 1 0];
>> all(A)
ans =
  logical
   0
>> B = [zeros(1,3)' ones(1,3)' zeros(1,3)'];
>> all(B)
ans =
  1x3 logical array
   0   1   0
>> C(:,:,1) = ones(3); C(:,:,2) = zeros(3);
>> all(C,2) 
  3x1x2 logical array
ans(:,:,1) =
   1
   1
   1
ans(:,:,2) =
   0
   0
   0
>> all(C,[1,2])
  1x1x2 logical array
ans(:,:,1) =
   1
ans(:,:,2) =
   0
>> all(B,'all')
ans = 
  logical
   0