How to add field name as a string column to array
Afficher commentaires plus anciens
So I have an excel spreadsheet where each sheet is named. When I import this data into matlab, it creates a struct where its fields are the names of the sheets. and I'm trying to add a column to the data populated with the name of the spreadsheet but I'm new to matlab and can't figure it out. So the struct in matlab is like the following:
data = {
field1: [10x10 double]
field2: [10x10 double]
field3: [10x10 double]
}
and I'd like to process it to be like the following:
data = [
[10x11] %the extra column is filled with "field1"
[10x11] %extra column is "field2"
[10x11] %"field3"
]
where ultimately I want to merge everything and have
data = [30x11]
and each row is labeled with field1, field2 or field3.
I've tried several things such as using parfor loops but have not yet managed to make it work.
Any help would be appreciated. Thanks!
Réponses (0)
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!