Convert table entries to vectors?

277 visualizaciones (últimos 30 días)
Mal
Mal el 26 de Sept. de 2017
Comentada: Peter Perkins el 27 de Sept. de 2017
So I have a table data with 9 entries (vectors with integers I presume, not really sure how data is stored in tables). To simplify my code I need entries/vectors 2-9 to be saved as separate columns in a matrix. I know I can do this manually newMatrix = [data.ent2 data.ent3 ... data.ent9] but I want to do it in a nicer/smoother way. Any tips on how I do this?
Many thanx!

Respuesta aceptada

KL
KL el 26 de Sept. de 2017
Editada: KL el 26 de Sept. de 2017
  2 comentarios
Mal
Mal el 26 de Sept. de 2017
Did the trick, thanx!
Peter Perkins
Peter Perkins el 27 de Sept. de 2017
table2array and Steve's suggestion of data.Variables are equivalent syntaxes. Since you only want some columns, another alternative would be
newMatrix = data{:,2:9}

Iniciar sesión para comentar.

Más respuestas (1)

Steven Lord
Steven Lord el 26 de Sept. de 2017
If you want to combine all the variables in the table T into one array, and they can all be concatenated together, use T.Variables as listed on this documentation page.

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by