export to excel
6 ビュー (過去 30 日間)
古いコメントを表示
Hi
I have several variables which are 2x20 structures.
I want to capture and store all the values in the 2nd row and put this into excel.
How can I do this?
0 件のコメント
回答 (3 件)
Fangjun Jiang
2011 年 8 月 4 日
You may need to use struct2cell() to convert your structure to cell array and then use xlswrite(). Please give an example of your structure. There might be special things to deal with.
0 件のコメント
Fangjun Jiang
2011 年 8 月 4 日
Okay, sounds like not a difficult data structure. Take a look at the example I made up, if similar, you can go ahead. This way, the data written to the Excel file keeps the shape of your structure,i.e. 2 rows 20 columns in your case.
NewVariable1=struct('cdata',repmat({50},2,2))
xlswrite('test.xls',reshape([NewVariable1.cdata],size(NewVariable1)))
3 件のコメント
Fangjun Jiang
2011 年 8 月 4 日
I am saying, you can open NewVariable1 in the variable editor, if it looks similar to what you saw on variable1 (except the size), then you can use my code to write to Excel file. Of course, you need to replace "NewVariable1" with "variable1" in the code. I was careful not to over-write the value of your "variable1".
Darina
2014 年 2 月 17 日
I have similar problem but it seems that my nested strucutre is also quite difficult to import to excel. I would like to import all the data from the last field 'flowArray' (which is of type double) into excel sheet?
My nested stucture looks like this:
currentFlowArray=allFileMin(i).demand_pattern1.Wm.total.flowArray;
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!