필터 지우기
필터 지우기

Ideal way to access data in a table?

조회 수: 1 (최근 30일)
Patrick Aoun
Patrick Aoun 2018년 8월 17일
댓글: Walter Roberson 2018년 8월 24일
Is there a "prefered" way to access data in a table?
T.var1(1);
T{1,var1};
T{1,1};
  댓글 수: 3
Peter Perkins
Peter Perkins 2018년 8월 24일
+1 to Stephen, however, T{1,var1} would have to be T{1,'var1'}. Also, while I find T.var1(1) easier to follow than t{1,'var1'}, once you get to accessing the data in more than one variable in a table all at once, braces are the way to go: T{1,{'var1' 'var2'}}.
Walter Roberson
Walter Roberson 2018년 8월 24일
If you are importing from a csv or xls or xlsx, then a question becomes which you trust to be more accurate as files change: column number, or column header.
Some "standard" formats (even if only unofficial standards) define information according to column; others define by column names.
If your users expect to be able to insert columns at arbitrary points as long as they keep the column headers the same for what is already there, then you should probably be using column name.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by