From: Matt Fig on 7 May 2010 13:56 You might want to have a look at this FEX file: http://www.mathworks.com/matlabcentral/fileexchange/23840-cprintf-a-pedestrian-nd-array-formatting-and-display-utility
From: us on 7 May 2010 14:23 "Catalin Eberhardt" <longtalker(a)gmail.com> wrote in message <hs1h8g$m3c$1(a)fred.mathworks.com>... > Say I define a cell array as follows: > > c = {'Name', 'Surname', grades}; > > where grades is a numerical vector, defined as follows: > > grades = [7 8 6 10]; > > My question is, how can I have c look like this: > > c = > 'Name' 'Surname' 7 8 6 10] > > instead of like this, as Matlab currently arranges it: > > c = > 'Name' 'Surname' [1x4 double] > > Many thanks for any help! one of the solutions - note: it will NOT look like what you want... g=[7,8,6,10]; cg=num2cell(g); c={'name','surname',cg{:}} % c = 'name' 'surname' [7] [8] [6] [10] % now, if you donwload what matt suggested (CPRINTF)... cc=cprintf(c) % cc = name surname 7 8 6 10 us
From: us on 7 May 2010 14:25
Walter Roberson <roberson(a)hushmail.com> wrote in message <DmYEn.455$jt.200(a)newsfe04.iad>... > Catalin Eberhardt wrote: > > Say I define a cell array as follows: > > > > c = {'Name', 'Surname', grades}; > > > > where grades is a numerical vector, defined as follows: > > > > grades = [7 8 6 10]; > > > > My question is, how can I have c look like this: > > > > c = 'Name' 'Surname' 7 8 6 10] > > > > instead of like this, as Matlab currently arranges it: > > > > c = 'Name' 'Surname' [1x4 double] > > You cannot, other than by overriding the display method for cell arrays. > > If you were to use > > c = {'Name', 'Surname', num2cell(grades)}; > > then c would display as > > 'Name' 'Surname' [7] [8] [6] [10] sorry... but this yields grades=[7,8,6,10]; c={'Name', 'Surname', num2cell(grades)} % c = 'Name' 'Surname' {1x4 cell} us |