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

    %% Rearrange Array to Operate on First Nonsigleton Dimension
% This example shows how |shiftdata| and |unshiftdata| work when you define
% |dim| as empty.

% Copyright 2015 The MathWorks, Inc.


%%
% Define |x| as a row vector.

x = 1:5

%%
% Define |dim| as empty to shift the first non-singleton dimension of |x|
% to the first column. |shiftdata| returns |x| as a column vector, along
% with |perm|, the permutation vector, and |nshifts|, the number of shifts.

[x,perm,nshifts] = shiftdata(x,[])

%%
% Using |unshiftdata|, restore |x| to its original shape.

y = unshiftdata(x,perm,nshifts)