How to combine multiple tables from diffrent folders and save as on table?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Tomaszzz
el 9 de Mzo. de 2022
Respondida: Voss
el 11 de Mzo. de 2022
Hi all,
I have 20 folders with mutiple mat files which are 1 x 1 structures with a 1 x 54 table.
I managed to list all folders and all files. I can also load each mat files in a loop as below.
for k = 1:numel(file_list)
if isempty(file_list{k})
continue
end
disp(file_list{k}.name)
A = fullfile(topLevelFolder,subFolders(k).name,file_list{k}.name);
data = load(A);
end
Now, I want to consecutively save each table with an end result a single 20x54 table (mat or csv) . For example:
End table:
Row 1: row 1 from table 1
Row 2: row 1 from table 2
Row 3: row 1 table 3
and so on
Can you help please?
0 comentarios
Respuesta aceptada
Voss
el 11 de Mzo. de 2022
t = {};
for k = 1:numel(file_list)
if isempty(file_list{k})
continue
end
disp(file_list{k}.name)
A = fullfile(topLevelFolder,subFolders(k).name,file_list{k}.name);
data = load(A);
t{end+1} = data.your_table_in_A;
end
t = vertcat(t{:});
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Text Files en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!