obtain matrix for multiple files

1 visualización (últimos 30 días)
Ernest Adisi
Ernest Adisi el 31 de Jul. de 2018
Comentada: Guillaume el 31 de Jul. de 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 comentario
Guillaume
Guillaume el 31 de Jul. de 2018
Note that as commented in your previous question, your matrix population loop is unneeded.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Logical 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!

Translated by