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

    %% Rotate Multidimensional Array  

%% 
% Create a 3-by-3-by-2 cell array of characters. 
A = cat(3,{'a' 'b' 'c';'d' 'e' 'f';'g' 'h' 'i'},{'j' 'k' 'l';'m' 'n' 'o';'p' 'q' 'r'})  

%% 
% Rotate the cell array by 270 degrees. 
B = rot90(A,3) 

%%
% The function rotates each page of the array independently. Since a full
% 360 degree rotation (|k = 4|) leaves the array unchanged, |rot90(A,3)|
% is equivalent to |rot90(A,-1)|.