Skip to content
Snippets Groups Projects
Select Git revision
  • ccb6a4208615a7f39b2fd63ea0bb451e7475fa5d
  • master default protected
  • wip/kalman-filter-adjustments
  • exp/re-enable-mercator-projection
  • v2.0
  • v1.0
6 results

flatten.m

Blame
  • flatten.m 446 B
    function C = flatten(A)
    % 
    % C1 = flatten({{1 {2 3}} {4 5} 6})
    % C2 = flatten({{'a' {'b','c'}} {'d' 'e'} 'f'})
    % 
    % Outputs:
    % C1 = 
    %     [1]    [2]    [3]    [4]    [5]    [6]
    % C2 = 
    %     'a'    'b'    'c'    'd'    'e'    'f'
    %
    % Copyright 2010  The MathWorks, Inc.
    C = {};
    for i=1:numel(A)  
        if(~iscell(A{i}))
            C = [C,A{i}];
        else
           Ctemp = flatten(A{i});
           C = [C,Ctemp{:}];
           
        end
    end