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

    %% Generate Array of Logical Ones with Arbitrary Dimensions  
% Use |true| to generate a 3-by-2-by-2 matrix of logical ones.   

%%  
true(3,2,2) 

%%
% Alternatively, you can use a size vector to specify the size of the
% matrix.

%%  
true([3,2,2]) 

%%
% Note that specifying multiple vector inputs returns an error.