Re: cat applied to cell array
- From: checker <checkeraz69@xxxxxxxxx>
- Date: Fri, 30 Nov 2007 10:06:21 -0800 (PST)
On Nov 30, 10:59 am, rober...@xxxxxxxxxxxxxxxxxx (Walter Roberson)
wrote:
In article <fiphm2$1t...@xxxxxxxxxxxxxxxxxx>,
Matt Fig <spama...@xxxxxxxxx> wrote:
I have a cell array of strings,g, that is 10-by-3, and I
wish to have a cell array of strings that is 10-by-1. The
'rows' of h should be the concatenated strings in g. This
works for what I want:
for ii = 1:length(g),h{ii} = [g{ii,1},g{ii,2},g{ii,3}];end
But is there a way to do this without a loop? I tried
cellfun with @cat, but I cannot pass the dim arg to cat (why
oh why?)
arrayfun(@(n) [g{n,:}],1:size(g,1),'UniformOutput',0)
--
"Any sufficiently advanced bug is indistinguishable from a feature."
-- Rich Kulawiec
Much less cool looking:
h=strcat(g(:,1),g(:,2),g(:,3))
-Chris
.
- References:
- cat applied to cell array
- From: Matt Fig
- Re: cat applied to cell array
- From: Walter Roberson
- cat applied to cell array
- Prev by Date: Re: Simple Question about extracting certain values from a matrix
- Next by Date: Re: cat applied to cell array
- Previous by thread: Re: cat applied to cell array
- Next by thread: Re: cat applied to cell array
- Index(es):
Relevant Pages
|