Working with .mat file format and need to alter it according to requirements.

Hi ,
I have a .mat file with 12 different parameters and each of these is a 30000*1 array.
I need to combine them to form an array with dimensions 30000*6 and rest 6 parameters I don't need. Also I have 60 of these .mat files with similar information. How can i get one .mat file with an array of (1800000*6) where 1800000 are the reading from all .mat files (30000*60 mat files)?

 Respuesta aceptada

If the 60 mat files are in your current directory and the 6 parameters are named var1, var2, ... ,var6:
d = dir('*.mat');
for i=1:numel(d)
load(d(i).name)
if i == 1
all = [var1 var2 var3 var4 var5 var6];
else
all = [all; var1 var2 var3 var4 var5 var6];
end
end
save('all.mat', 'all')

Más respuestas (0)

Categorías

Productos

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by