フィルターのクリア

How to create a table name using a string variable?

39 ビュー (過去 30 日間)
Gabor
Gabor 2019 年 3 月 4 日
コメント済み: Walter Roberson 2020 年 6 月 3 日
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
Mustafa Calcuttawala 2020 年 6 月 3 日
@stephen Can you please elaborate what you mean by indexing? How exactly do I use this indexing?
Walter Roberson
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
Gabor 2019 年 3 月 4 日
I guess I will just use a cell which I will be store the the variable for the "name that should be" and the table itself too...
Thank you
  1 件のコメント
Steven Lord
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 件)

Walter Roberson
Walter Roberson 2019 年 3 月 4 日

Gabor
Gabor 2019 年 3 月 8 日
Thank you all

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by