File Exchange

image thumbnail

mergecell

version 1.0 (1.77 KB) by

Appends cell arrays together along the dimension of your choosing (limited to 2d cell arrays).

0 Downloads

Updated

View License

% OUT = MERGECELL(IN1,IN2,...INx,DIM)
%
% MERGECELL simply merges cell arrays (IN1,IN2,...,INx) together by
% appending them along the DIM dimension. There is no requirement that the
% input cell arrays have similar dimensions. The result is a cell array
% large enough to accomodate the sizes of each input array with blanks
% filling the empty spots.
%
% Example:
%
% a{1} = {'a','b','c','d','e'};
% a{2} = {'f';'g';'h'}; %-- Notice these are different orientations
%
% out = mergecell(a{:},1)
%
% returns: 'a' 'b' 'c' 'd' 'e' 'f'
% [] [] [] [] [] 'g'
% [] [] [] [] [] 'h'
%
%
% out = mergecell(a{:},2)
%
% returns: 'a' 'b' 'c' 'd' 'e'
% 'f' [] [] [] []
% 'g' [] [] [] []
% 'h' [] [] [] []
%
%
% out = mergecell(a{1},a{2}',1)
%
% returns: 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h'
%
%
% Copyright (C) 2011 Jeremy Brower.
% jeremy.brower@gmail.com

Comments and Ratings (0)

MATLAB Release
MATLAB 7.9 (R2009b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video