LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read files from a folder, sort them ascending order.

Hi everyone!

 

Thanks in advance for your help, because I am becoming crazy.

 

What I have is a folder with images named as: Image1, Image2, Image3... Image9900 .... I list the files that match "*.jpg" pattern, in order to read the images and analyse them. I've read some threads in this forum and try all the answers, add a cluster with the number and try to sort the array (does not work), use a stack to sort the strings, also does not work, when it arrives to 9 number it starts to list all the images that starts with 9. 

 

how  sth apparently easy can be so strange to implement. 😞

 

Just say that the windows explorer is sorting the files fine, and I cannot use time stamp because the images where adquired at 506 frames per second so some of them have the same time stamp I guess...

 

 

Thanks everyone for reading me ! 

 

Maite

 

Any help will be welcomed, thanks!! 

0 Kudos
Message 1 of 8
(409 Views)

Get the List of Filenames and apply an AlphaLogical sort

https://forums.ni.com/t5/Example-Code/AlphaLogical-Bubble-Sorting-Algorithm-in-LabVIEW/ta-p/3492488

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 8
(405 Views)

Try to scan the image number and sort by number, see

 

Sort Filenames By Number.png

Message 3 of 8
(398 Views)

VIPM: https://www.vipm.io/package/mgi_lib_1d_array/
Use function called: "MGI Natural Sort.vi".

maxnoder1995_0-1729602344404.png

 

Message 4 of 8
(388 Views)

Thanks for your answer, I tried Logical String Array Sort, but not this one, and this is actually working fine 🙂 

 

It is quite slow and we are working with a huge number of images, but al least we can process the data in sequence, I will look for something faster I may have good luck, but if not we can continue working, thanks!!

 

 

0 Kudos
Message 5 of 8
(286 Views)

Yep, I tried this as first idea but I do not know why this Sort1darray function it is not working fine, I checked the cluster, and it records the decimal numbers fine, but the function has problems sortening a big amount of images, some of them are right some are wrong.

 

But thanks anyway, It was a good idea! 

0 Kudos
Message 6 of 8
(284 Views)

Hi Tweezers,

 


@MagneticTweezers wrote:

but the function has problems sortening a big amount of images, some of them are right some are wrong.


It would help if you would provide examples for your message.

Which filenames are sorted "right", which ones are sorted "wrong"?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 8
(278 Views)

@MagneticTweezers wrote:

It is quite slow


Hi, for your specific task, you can use this code. It is the fastest of all the options offered to you and does the job perfectly.

maxnoder1995_0-1729772365583.png

 

Message 8 of 8
(250 Views)