Create vectors from a table
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Attached is a sample of a large table. I want to create a vector for each column in thetable (i.e 2891 vectors) where the name of each vector is the header of the column in the table (e.g., create a vector called RSSD9999 which is column 1 in the table , another RSSD9001 which is column 2 in the table). how can I do this since manually it takes a lot of time and the size of table and the name of vectors is changing across files.
0 Commenti
Risposte (1)
Walter Roberson
il 21 Nov 2016
We recommend against that firmly.
Already, a table acts like a struct for the purpose of dynamic field name access.
V = 'RCON8697';
sample.(V)
and if you do not need to work with the names dynamically then you can just access by field name.
sample.RCON8697
You could also use table2struct() to move directly to struct form, if that is helpful.
fieldnames() can be applied to a table, but it does return the extra names 'Properties', 'Row', and 'Variables' beyond the variable names.
0 Commenti
Vedere anche
Categorie
Scopri di più su Tables in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!