How to extract contents from cell array
9 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Cedric
2013 年 1 月 22 日
編集済み: Cedric
2013 年 1 月 22 日
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 件のコメント
Cedric
2013 年 1 月 23 日
編集済み: Cedric
2013 年 1 月 23 日
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.
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!