Borrar filtros
Borrar filtros

Moving Bulk MATLAB file to different folders

2 visualizaciones (últimos 30 días)
Prasad Joshi
Prasad Joshi el 24 de En. de 2022
Editada: Prasad Joshi el 24 de En. de 2022
I m moving bulk matlab files to a different folder .For one file I did using Movefile command....Can someone suggest code for loading the file in one go instead of using Movefile command everytime ...Like Case161.mat to case 161 then case163.mat to case 163 so on.....Thank you in advance ....

Respuesta aceptada

Stephen23
Stephen23 el 24 de En. de 2022
Editada: Stephen23 el 24 de En. de 2022
P = 'absolute or relative path to where the files are saved':
S = dir(fullfile(P,'*.mat'))
for k = 1:numel(S)
[~,N,~] = fileparts(S(k).name);
D = fullfile(P,N);
F = fullfile(P,S(k).name);
mkdir(D) % optional
movefile(F,D)
end
  1 comentario
Prasad Joshi
Prasad Joshi el 24 de En. de 2022
Editada: Prasad Joshi el 24 de En. de 2022
Thank you Stephen ...The code work and was able to sort also ...

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown 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