LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Skip non-image files when adding images to array from file

Solved!
Go to solution

Hi,

 

I am reading images that are stored in a folder into an image array. I have a slight problem when a non image file (using .png) is present.

 

What I have tried is to use a case structure to check if the file extension is a png (if it is a png then add to the array), if it is not a png file, then the false case is executed and a blank is inserted into the image array, since I have selected to "Use default if unwired". What I ultimately would like is for it to skip all non image files and have a image array with no blanks.

 

I honestly do not know what to do.

 

Could anyone please offer advice? Let me know if you would like any other information.

 

Regards,

 

Richard

0 Kudos
Message 1 of 4
(2,201 Views)
Solution
Accepted by topic author tyrrellvw

List Folder.png Use a Pattern filer when you get your files from the folder, then you don't need to sort the files out after - SimpleSmiley Happy

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 2 of 4
(2,180 Views)

Hi Richard,

 

while James noted the correct approach to only list PNG files in the first place you should consider for the next time:

Only do your "add to array" operation in the TRUE case. Then you don't need to output some default values from your case structure!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 4
(2,177 Views)

Thank you James! 

 

I will be honest, I saw that VI but I was unsure about what it did. I was using the List Folder VI and then comparing each file in the folder.

 

Still a rookie and had to self teach myself LabVIEW, there are a few things that I overlook.

 

Richard

0 Kudos
Message 4 of 4
(2,174 Views)