how to write a struct to a .xls or txt file
1 回表示 (過去 30 日間)
古いコメントを表示
station = struct(...
'name', {'CD2', 'GYA', 'GOM', 'XAN', 'LZH','KMI', 'LSA','MDJ','WMQ','CNS', 'GUL', 'GZH', 'HEF', 'QZH', 'WHN','WZH'},...
'Jingdu',{103.76 ,106.66,103.84,94.81,108.92,102.74,91.10,129.59,87.69,112.59,110.12,113.65,117.17,118.60,114.35,120.40},...
'Weidu',{30.91, 26.46, 36.09, 36.20, 34.03,25.12,29.73,44.62,43.65,28.12,25.12,23.65,31.52,24.94,30.54,27.55});
1.how can i save it into a xls file , and then load it from the xls file?
0 件のコメント
回答 (1 件)
Image Analyst
2014 年 4 月 18 日
編集済み: Image Analyst
2014 年 4 月 18 日
Use struct2table() and writetable():
t = struct2table(station)
writetable(t, 'station.xlsx');
5 件のコメント
Image Analyst
2014 年 4 月 18 日
OK, so you read it in with some unspecified function (probably xlsread) and then you convert the array or cell array into a structure for convenience elsewhere in your program. OK fine. If you then change that structure and want to save it back out in the original form back to your Excel workbook file, you're going to have to either change your original cell array that you read in, or else use struct2table. Then you're going to have to write back that changed variable to the workbook file with xlswrite() or writetable().
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!