www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/TestArraysOfAnyDimensionAnyExample.m

    %% Test Arrays of Any Dimension  

%% 
% Create a 3-by-7-by-5 multidimensional array and test to see if any of
% its elements are greater than 3. 
A = rand(3,7,5) * 5;
B = any(A(:) > 3)  

%% 
% You can also test the array for elements that are less than zero. 
B = any(A(:) < 0) 

%%
% The syntax |A(:)| turns the elements of |A| into a single column vector,
% so you can use this type of statement on an array of any size.