フィルターのクリア

Change variable name in a loop

2 ビュー (過去 30 日間)
Sehoon Chang
Sehoon Chang 2020 年 8 月 29 日
コメント済み: Stephen23 2020 年 8 月 29 日
Hi,
I have multiple excel table data, that are imported to MATLAB in a loop function.
csvFiles = dir('*.csv');
numfiles_csv = length(csvFiles)
for a = 1:numfiles_csv
readtable(csvFiles(a).name)
end
I wish to name each table with numbers (e.g. table1, table2, etc.).
Currently when i run the code, all the tables are shown with a output name 'ans', which is preventing me from further allocation task.
thanks.
  3 件のコメント
Sehoon Chang
Sehoon Chang 2020 年 8 月 29 日
Thank you Stephen for the comment.
As you have mentioned i also tried using the upper link you have provided.
csvFiles = dir('*.csv');
numfiles_csv = length(csvFiles)
mydata_csv = cell(1,numfiles_csv)
for a = 1:numfiles_csv
mydata_csv{a} = readtable(csvFiles(a).name)
end
Could you please provide me with links or examples how i could make the tables visible,
instead of having output like the following:
mydata_csv = 1×2 cell array
{301×2 table} {104853×12 table}
thanks
Stephen23
Stephen23 2020 年 8 月 29 日
"Could you please provide me with links or examples how i could make the tables visible,"
mydata_csv{1} % the 1st table
mydata_csv{2} % the 2nd table
mydata_csv{3} % the 3rd table
...etc

サインインしてコメントする。

回答 (1 件)

Matt J
Matt J 2020 年 8 月 29 日
Tables{a} = readtable(csvFiles(a).name)
  1 件のコメント
Sehoon Chang
Sehoon Chang 2020 年 8 月 29 日
Hi Matt, thanks for the reply.
I have tried that already. But the result that i receive is as following:
Tables = 1×2 cell array
{301×2 table} {104853×12 table}
Is there a secondary coding needed to make the table itself visible?

サインインしてコメントする。

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by