Convert table entries to vectors?

359 次查看(过去 30 天)
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!

采纳的回答

KL
KL 2017-9-26
编辑:KL 2017-9-26
  2 个评论
Peter Perkins
Peter Perkins 2017-9-27
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}

请先登录,再进行评论。

更多回答(1 个)

Steven Lord
Steven Lord 2017-9-26
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.

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by