obtain matrix for multiple files

1 vue (au cours des 30 derniers jours)
Ernest Adisi
Ernest Adisi le 31 Juil 2018
Commenté : Guillaume le 31 Juil 2018
I have this code which reshapes column vectors from the file 'B00049' into 4 different matrices for x y u v now i want to scale this for multiple files in a folder. How can i construct the for loop to process the matrices as for the 1 file
this is the code for 1 file
filename= 'B00049.dat'
delimiterIn= ' ';
headerlinesIn = 3;
A= importdata(filename,delimiterIn,headerlinesIn);
%% Matrices%%%%
c = 214;%columns
r = 134;%rows
x= zeros(r,c);
y= zeros(r,c);
u= zeros(r,c);
v= zeros(r,c);
%% Matrix population
for j=1:r x(j,:) = A.data((j-1)*c+1:j*c,1);
y(j,:) = A.data((j-1)*c+1:j*c,2);
u(j,:) = A.data((j-1)*c+1:j*c,3);
v(j,:) = A.data((j-1)*c+1:j*c,4);
end
now I want to know how to 'for loop' for multiple files in a folder so it processes each one to obtain the 4 matrices for each. Anyone have an idea please
  1 commentaire
Guillaume
Guillaume le 31 Juil 2018
Note that as commented in your previous question, your matrix population loop is unneeded.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Software Development Tools dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by