www.gusucode.com > bigdata 工具箱 matlab源码程序 > bigdata/@tall/squeeze.m

    function b = squeeze(a)
%SQUEEZE Remove singleton dimensions.
%   B = SQUEEZE(A) returns an array B with the same elements as
%   A but with all the non-tall singleton dimensions removed.
%
%   See also tall/cat.

% Copyright 2015-2016 The MathWorks, Inc.

clz = tall.getClass(a);
if isequal(clz, 'table')
    % nothing to squeeze as table is already 2-d
    b = a;
else
    b = slicefun(@(a) iSqueezeSmallDims(a), a);
    b.Adaptor = resetSizeInformation(a.Adaptor);
end
end

function a = iSqueezeSmallDims(a)
if iscolumn(a)
    return;
end
siz = size(a);
siz([false (siz(2:end) == 1)]) = []; % Remove singleton dimensions.
a = reshape(a,siz);
end