Saving a structure to Excel
Afficher commentaires plus anciens
I have a simple (albeit large) structure that follows the pattern Year.Variable.Month.TimeSlot
There are 8 TimeSlot values, and when opened each one displays a 16x1 array. I'm looking for something that will enable me to save all 8 of these values into excel (i.e. saving a single month of data). If there was a way to save each month onto the same Excel file, this would be great, however I don't mind a little manual cutting and pasting to put all the months together on a single sheet.
Any help would be massively appreciated.
Réponse acceptée
Plus de réponses (2)
David Sanchez
le 13 Oct 2014
0 votes
take a look at this linK:
Where is clearly stated:
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.
1 commentaire
Gareth Pritchard
le 13 Oct 2014
Modifié(e) : Gareth Pritchard
le 13 Oct 2014
Anmol Pardeshi
le 9 Fév 2018
0 votes
If struct to cell and then conversion is a problem, you can individually collect the fields and their values in a matrix (table) and then export it to excel. I have a struct with 8 field and the last field has a string matrix of n-by-2 dimension. the way I solved this problem was - a. start a new matrix (table) b. collect the 1st, 2nd, 3rd field in cols 1/2/3 rectvly., of this new table. c. in the 4th & 5th col, I copied the n-by-2 (or essentially the 2 cols of last field in struct corresponded to the last 2 cols of the new table)
the new table is ought to increase in length because it becomes something like a table that expands in the last col i.e. something like the diagram of the FFT butterfly.
I can share the code if anyone needs it. :)
1 commentaire
raghvendra deshpande
le 6 Mar 2018
Yes .. Please share the code
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!