Create vectors from a table
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Walter Roberson
el 21 de Nov. de 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 comentarios
Ver también
Categorías
Más información sobre Tables en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!