how to format cell array
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Adam Danz
el 1 de Jul. de 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
el 1 de Jul. de 2018
Editada: dpb
el 1 de Jul. de 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{:});
Respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!