Prev: plot a political map
Next: F28335 plus TIMER1
From: Ulrich on 10 Jun 2010 08:29 I am facing a problem like: I have a variable cell array (n,m) of strings e.g.: C= 'ab' 'egh' 'zgr',..... 'hlk' 'd' 'zg',.... ....... ...... the result shoud be: D= 'abeghzgr.....' 'hlkdzg....' ....... ...... to me, shoud be 'horzcat',like D=horzcat(C). But does not work. Please post only a solution without loops thx John
From: Jos (10584) on 10 Jun 2010 12:17 "Ulrich" <millim1974(a)yahoo.com> wrote in message <huqlqh$mbd$1(a)fred.mathworks.com>... > I am facing a problem like: > I have a variable cell array (n,m) of strings e.g.: > C= > 'ab' 'egh' 'zgr',..... > 'hlk' 'd' 'zg',.... > ....... > ...... > the result shoud be: > > D= > 'abeghzgr.....' > 'hlkdzg....' > ....... > ...... > > to me, shoud be 'horzcat',like D=horzcat(C). But does not work. > > Please post only a solution without loops > > thx > John help STRCAT C = {'1a' 'bb1' ; '2aaaa' 'b2' ; '3aaaa' 'bbbbbbbb3'} D = strcat(C(:,1),C(:,2)} Jos
From: Bruno Luong on 10 Jun 2010 12:39 "Jos (10584) " <#10584(a)fileexchange.com> wrote in message <hur360$jqp$1(a)fred.mathworks.com>... > help STRCAT > > C = {'1a' 'bb1' ; '2aaaa' 'b2' ; '3aaaa' 'bbbbbbbb3'} > D = strcat(C(:,1),C(:,2)} > > Jos Nice. To generalize the above to multi-column cell: D = num2cell(C,1); D = strcat(D{:}); Bruno
From: Jos (10584) on 11 Jun 2010 06:10 "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hur4fa$fo6$1(a)fred.mathworks.com>... > "Jos (10584) " <#10584(a)fileexchange.com> wrote in message <hur360$jqp$1(a)fred.mathworks.com>... > > > help STRCAT > > > > C = {'1a' 'bb1' ; '2aaaa' 'b2' ; '3aaaa' 'bbbbbbbb3'} > > D = strcat(C(:,1),C(:,2)} > > > > Jos > > Nice. To generalize the above to multi-column cell: > > D = num2cell(C,1); > D = strcat(D{:}); > > Bruno Nice generalization, Bruno! C = {'Perhaps ' 'someone ' 'can' ; 'time ' 'the ' 'solutions' ; 'to ' 'this ' 'problem ?'} ; D1 = num2cell(C,1) D1 = strcat(D1{:}) Jos
|
Pages: 1 Prev: plot a political map Next: F28335 plus TIMER1 |