How to apply function to certain files in directory
Mostrar comentarios más antiguos
I have a directory full of different files. The function I have will fopen and fread the content and process it to create other files. My function takes in parameter (parameter being the title of the file), but I would like to make the function run through the directory and read only the .raw files in that folder. Any help?
Respuesta aceptada
Más respuestas (1)
D = 'relative/absolute path to the directory where the files are saved';
S = dir(fullfile(D,'*.raw'));
for k = 1:numel(S)
F = fullfile(D,S(k).name);
yourFunction(F)
end
1 comentario
Moulvi Faizan Ahmed
el 11 de Dic. de 2019
Editada: Moulvi Faizan Ahmed
el 11 de Dic. de 2019
Worked like charm, thank you
Categorías
Más información sobre Search Path en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!