MATLAB: Logical operations on logical matrices

logical?MATLABmatrix

I have a 3-dimensional matrix with logical values, A, sized 3000 x 4000 x n, where n varies depending on iteration, but is usually between 1 and 10.
I'm trying to create a 2-dimensional matrix with logical values, B, sized 3000 x 4000, where a given element would be set to 'true' if any of the corresponding elements in A (same row and column, any n) is 'true', or to 'false' in other cases (i.e. when all corresponding elemnents in A are 'false').
I'm sure there is a way to do it without a loop by row/column or switching back and forth between logicals and integers. Thanks in advance for help!

Best Answer

Use any
b=any(A, 3)