obtain matrix for multiple files

2 次查看(过去 30 天)
Ernest Adisi
Ernest Adisi 2018-7-31
评论: Guillaume 2018-7-31
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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by