s = {'a','b','c'}
but it gets
s = {{'a','b'},'c'}
This happens frequently and I wrote some code to flatten the latter
example to become the former.
Does anybody have well written code for this? Mine's a little
kludgy? I'm assuming I have left out some possible circumstances
when I slapped it together.
Michael,
I quickly modified this from celldisp:
% ===========================
function s = mrt(c)
error(nargchk(1,1,nargin));
if ~iscell(c),
error('Must be a cell array.');
end
s{1} = [] ;
for i=1:prod(size(c)),
if iscell(c{i}),
y = mrt(c{i}) ;
[s{end+1:end+length(y)}] = deal(y{:}) ;
else
s{end+1} = c{i} ;
end
end
s(1) = [] ;
% ===========================
hth,
Jos