How to create a table name using a string variable?
47 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Gabor
am 4 Mär. 2019
Kommentiert: Walter Roberson
am 3 Jun. 2020
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 Kommentare
Mustafa Calcuttawala
am 3 Jun. 2020
@stephen Can you please elaborate what you mean by indexing? How exactly do I use this indexing?
Walter Roberson
am 3 Jun. 2020
Mustafa Calcuttawala: please read the material at the link that Stephen posted. It shows a number of different possibilities.
Akzeptierte Antwort
Gabor
am 4 Mär. 2019
1 Kommentar
Steven Lord
am 4 Mär. 2019
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
Weitere Antworten (2)
Siehe auch
Kategorien
Mehr zu Whos finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!