how do I open files automatically in certain order?(numbers giving me trouble)
Mostra commenti meno recenti
So, say I have these files named 1.0.txt, 1.5.txt, 2.0.txt, 2.5.txt, ... 10.0.txt, 10.5.txt
I am automatically opening the files by loop and do what I have to do with the file.
However, Matlab seems to see the file order starting from the first letter.
There fore, Matlab executes the loop in the order of 1.0.txt, 1.5.txt, 10.0.txt, 10.5.txt, 2.0.txt, 2.5.txt... and so on.
I can I avoid this and make the loop go in the order of 1.0, 1.5, 2.0, 2.5, ... 10.0, 10.5 ?
I am doing fprintf and the order is important for my calculation..
Risposta accettata
Più risposte (1)
Image Analyst
il 27 Gen 2016
2 voti
You're going to have to get the base filename, and parse it to find the number. Try using sscanf() or str2double().
Categorie
Scopri di più su Programming in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!