Convert table entries to vectors?

조회 수: 247 (최근 30일)
Mal
Mal 2017년 9월 26일
댓글: Peter Perkins 2017년 9월 27일
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
Mal
Mal 2017년 9월 26일
Did the trick, thanx!
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