How to create a table name using a string variable?
조회 수: 39 (최근 30일)
이전 댓글 표시
Hi,
How can I use a string variable for a table name?
eg.:
-----------------------------
T = 'ThisShouldBeMyTableName';
VariableNames = {'StartCash','EndDate'};
T = table(input_values.StartCash, input_values.EndDate, 'VariableNames',VariableNames);
-----------------------------
The table which is create should be named "ThisShouldBeMyTableName" not "T".
Thank you
댓글 수: 3
Mustafa Calcuttawala
2020년 6월 3일
@stephen Can you please elaborate what you mean by indexing? How exactly do I use this indexing?
Walter Roberson
2020년 6월 3일
Mustafa Calcuttawala: please read the material at the link that Stephen posted. It shows a number of different possibilities.
채택된 답변
Gabor
2019년 3월 4일
댓글 수: 1
Steven Lord
2019년 3월 4일
Or you could create a struct array with one field that contains your table and name that field using either the struct function or dynamic field names.
thefield = 'snowstorm';
data = magic(4);
structOfTables = struct(thefield, data)
structOfTables2.(thefield) = data
추가 답변 (2개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!