Azzera filtri
Azzera filtri

how to format cell array

3 visualizzazioni (ultimi 30 giorni)
david Pham
david Pham il 1 Lug 2018
Modificato: dpb il 1 Lug 2018
so my code outputs a 1x36 cell array in the workspace when executed, i need to reformat the cell array so that once you double click the 1x36 cell array all the values are 1x1 cells. so for instance i click on the 1x36 cell array and if i need the 4th column value i go to the fourth column and double click the 1x1 cell and then the value appears.
  3 Commenti
Adam Danz
Adam Danz il 1 Lug 2018
I'm not sure I understand complete so correct me if I'm wrong. You currently have a cell array like this
a = {1 2 3 4 5 6};
but you want this
a = {{1} {2} {3} {4} {5} {6}};
Is that right?
dpb
dpb il 1 Lug 2018
Modificato: dpb il 1 Lug 2018
Why not just use a regular 1D vector array and have all the values directly?
a=cell2mat(c);
No clickee needed... :)
Cell arrays are fine when one has either disparate data types or "jagged" arrays or the like, but when "regular" array will suffice it's generally much simpler to code and less memory and faster to boot...
But, iff'en you're determined, I think what you're asking for is
c=num2cell(c{:});

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by