how do I open files automatically in certain order?(numbers giving me trouble)
Afficher commentaires plus anciens
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..
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 27 Jan 2016
2 votes
You're going to have to get the base filename, and parse it to find the number. Try using sscanf() or str2double().
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!