how do I concatenate mat files matlab
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have hundreds of MAT files and i want to concatenate all these files to a single file,each MAT file has dimension of 69x128,here is the technique that I follwed before for fewer files but this is not comfortable for me please provide some comformtable and simpler way to dothe same job
a1=load(sprintf('datafile_%02d',1));
a2=load(sprintf('datafile_%02d',2));
P1 = a.dataselection(:,5:132);
P2 = a2.dataselection(:,5:132);
PO = [P1;P2];
save('PO')
load('PO')
0 Commenti
Risposta accettata
Voss
il 20 Dic 2023
Modificato: Voss
il 21 Dic 2023
N = 200; % number of files (assumed to be named datafile_01.mat, _02.mat, ..., _10.mat, ..., _99.mat, _100.mat, ..., as you have specified with '%02d')
C = cell(1,N);
for ii = 1:N
A = load(sprintf('datafile_%02d.mat',ii));
C{ii} = A.dataselection(:,5:132);
end
PO = vertcat(C{:});
save('PO.mat','PO')
4 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!