Sort files based on last part of file name
Mostrar comentarios más antiguos
Hi,
I'm trying to sort a list of .dcm files to compile into a 3D scan. I need to sort them in their correct numerical order, but the file names are long and contain many numbers; only the very last part of the file holds the actual scan number. I'm trying to figure out how to get Matlab to sort the file names in their correct order so I can easily compile the images. I've looked at Stephen Cobeldick's Natural-Order Filename Sort, which looks helpful. I can't figure out how to use that or another tool to have it sort just based on the last few digits of the filename, however. For example, I have filenames like this that I need to sort:
2.16.840.1.114362.1.6.7.6.17718.8160090133.469658533.982.709.dcm
2.16.840.1.114362.1.6.7.6.17718.8160090133.469658533.1089.676.dcm
The .676.dcm file needs to be sorted before the .709.dcm file, but will not because the .1089 part is higher than the .982. I need to somehow sort these based only on those last few digits before the .dcm.
Thank you for any help!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Shifting and Sorting Matrices 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!