how to write a struct to a .xls or txt file
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Image Analyst
le 18 Avr 2014
Modifié(e) : Image Analyst
le 18 Avr 2014
Use struct2table() and writetable():
t = struct2table(station)
writetable(t, 'station.xlsx');
5 commentaires
Image Analyst
le 18 Avr 2014
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().
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!