How to extract contents from cell array
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I have a cell array that looks like this:
xdata =
[1x51 double]
[1x51 double]
[1x51 double]
[1x51 double]
ydata =
[1x51 double]
[1x51 double]
[1x51 double]
[1x51 double]
which I extracted from Matlab figure files. How can I see the contents in the xdata and ydata?
Thanks a lot for your help
0 comentarios
Respuestas (2)
Cedric
el 22 de En. de 2013
Editada: Cedric
el 22 de En. de 2013
A few other ways:
>> xdata{:}
or
>> cellfun(@(a)disp(a), xdata)
The content of cell #3, for example, of xdata can be accessed this way:
>> xdata{3}
it is a 1x51 numeric array, whose elements can be indexed, e.g. element #7 of cell #3 can be accessed this way:
>> xdata{3}(7)
3 comentarios
Cedric
el 23 de En. de 2013
Editada: Cedric
el 23 de En. de 2013
Actually Matt gave you the answer with the double-click. If you wanted to open cells one by one, you could type the following in the command line:
>> xdata{1}
and see that you are displaying the content of cell #1 of xdata (you can do the same with cells #2 to #4, and also the same with ydata). Then, based on Matt answer, you could type the following in the command window:
>> openvar xdata{1}
and observe that you have the same content, but this time in a spreadsheet. From there you can e.g. cut and paste into Excel.
If you wanted to automatize the export to Excel, you could try to build something based on xlswrite(). If you want to learn more, type the following in the command window:
>> doc xlswrite
but you will have to understand how to deal properly with cell arrays first I guess.
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!