www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/Sort3DArrayExample.m
%% Sort 3-D Array % Create a 2-by-2-by-2 array and sort its elements in ascending order along the third dimension. % Copyright 2015 The MathWorks, Inc. A(:,:,1) = [2 3; 1 6]; A(:,:,2) = [-1 9; 0 12]; A %% B = sort(A,3) %% % Use |A(:)|, the column representation of |A|, to sort all of the elements of |A|. B = sort(A(:))