How to create a table name using a string variable?
57 次查看(过去 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!