how do I open files automatically in certain order?(numbers giving me trouble)
Mostrar comentarios más antiguos
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..
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 27 de En. de 2016
2 votos
You're going to have to get the base filename, and parse it to find the number. Try using sscanf() or str2double().
Categorías
Más información sobre Programming 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!