Processing mutiple txt files from subfolders
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I am new to Matlab and so would like to ask for your help in modifying a routine:
Under this current routine, I am required to input individual txt files placed in specific folder directories and run the function. Naturally, all analyses results are saved in the same folder containing the txt file. Then, to process the others I need to move to another folder and rerun the routine. This proves to be really time consuming since I have quite a lot of samples and references to run...
Is there a way to modify the routine so that I can simply input a folder, then it will search for all the txt files placed in the subfolders, apply the Wavelet analysis on each one of the txt files, and save each analysis result (matrices, images, fig files) to the subfolder containing the txt file?
I tried consulting these threads: https://fr.mathworks.com/matlabcentral/answers/245959-how-to-read-text-files-from-different-sub-folders-in-a-folder
and modified the "input ascii file" section of the routine above, to no avail...
I hope my problem is clear enough. I'd appreciate any advice/help, thanks in advance!
0 Kommentare
Antworten (1)
Image Analyst
am 2 Apr. 2017
You can use dir() with two asterisks if you have a later version of MATLAB. See attached demo. If you don't then you can use genpath() to get files in all subfolders. I've attached a demo for that too.
2 Kommentare
Image Analyst
am 3 Apr. 2017
Post your code. You did something else. That line of code was line 43 in my demo, not line 17 like you had. Anyway, I changed that line to *.txt and it worked beautifully. You must have messed it up some other way.
And if anything before line 17/43 has wavelet stuff in it, I can't run that since I don't have the wavelet toolbox.
Siehe auch
Kategorien
Mehr zu Applications finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!