フィルターのクリア

concatenating with readtable function

7 ビュー (過去 30 日間)
Daniel Abraham
Daniel Abraham 2021 年 7 月 19 日
コメント済み: KSSV 2021 年 7 月 19 日
Hello Everyone. Please I'm trying to readtables from a multiple xml files in a loop. Each xml file holds data for a time period.
Using the code below reads each xml file as a table
table1: readtable('filename.xml')
but I want to read all the xml files in the folder at once as a table so I can get to see all data at once. When I try to read random xml files as tables. It seems most have the same amount variables but some differ. I think for me, it's okay if the code can skip these files.
Thank you so much

採用された回答

KSSV
KSSV 2021 年 7 月 19 日
xmlFiles = dir('*.xml') ;
N = length(xmlFiles) ;
T = cell(N,1) ;
for i = 1:N
T{i} = readtable(xmlFiles(i).name) ;
end
celldisp(T)
  2 件のコメント
Daniel Abraham
Daniel Abraham 2021 年 7 月 19 日
Thanks KSSV, it puts all the tables in a cell. That helps a lot!
Quick follow up, how does one concatenate all the simlar tables (similar variable names) in the cell as one table?
KSSV
KSSV 2021 年 7 月 19 日
If the varable names are same and T1, T2 can be joined:
T12 = [T1; T2] ;
Also have a look on cat.

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

その他の回答 (0 件)

カテゴリ

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