NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Member
Raymond99
Posts: 5
0 Kudos
Accepted Solution

how to load ONE file automatically from a folder containing sequential files?

I have pictures that is taken every 2 or 3 minutes and then dumped into a file folder with sequentail number as file names.

 

Now I want to find a routine to automatically check the last picture and load it into labview.

 

Please be aware that I already have other hardware to acquire images and store them in the computer, any advice with using other I/O device is appreciated , but not needed.

 

Task is simpel! (hopfully for you.)  Only need to find the latest file in a fixed folder and open it by labview (e.g., by read JEPG file.vi ).  any insights?

 

Thanks!

 

 

 

Active Participant
elset191
Posts: 1,219
0 Kudos

Re: how to load ONE file automatically from a folder containing sequential files?

If it contains ONLY sequential images you can use the File/Directory Info vi.  This returns the number of files in the folder.  If your files start at 0, subtract one from this value and use it as your file name.  You may need to append a .jpg or whatever also.
--
Tim Elsey
LabVIEW 2010, 2012
Certified LabVIEW Architect
Trusted Enthusiast
Coq_Rouge
Posts: 2,187
0 Kudos

Re: how to load ONE file automatically from a folder containing sequential files?

See if the accepted solution here http://forums.ni.com/ni/board/message?board.id=170&message.id=385845&query.id=269818#M385845 may help you. You have to modify it, so it is only ment as push in the right direction.



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Member
Raymond99
Posts: 5
0 Kudos

Re: how to load ONE file automatically from a folder containing sequential files?

Thanks, Tim.

 

My file's names are like this

 

...

picture 32.jpg

picture 33.jpg

picture 34.jpg

...

 

It's not always start with number 0.

The directory vi. that you ponited out will tell me weather there is a new file being written into the specified folder,

I wonder if there is another vi that can read the last file?

 

Raymond

 

Trusted Enthusiast
Coq_Rouge
Posts: 2,187
0 Kudos

Re: how to load ONE file automatically from a folder containing sequential files?

If you find that file, you can read it yes :smileywink:

Se picture



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Active Participant
elset191
Posts: 1,219
0 Kudos

Re: how to load ONE file automatically from a folder containing sequential files?

[ Edited ]

I wrote a VI to find the newest file (well, last modified file) in a given folder.

Message Edited by elset191 on 06-05-2009 09:08 AM
--
Tim Elsey
LabVIEW 2010, 2012
Certified LabVIEW Architect
Member
Raymond99
Posts: 5
0 Kudos

Re: how to load ONE file automatically from a folder containing sequential files?

Tim,

 

I also figured out, it's a bit different with your but it does the job.

 

Thanks for the help.

 

 

automatic load last file.png

 

 

 

Raymond

 

 

Member
Raymond99
Posts: 5
0 Kudos

Re: how to load ONE file automatically from a folder containing sequential files?

your link is quit usefull too.
Active Participant
elset191
Posts: 1,219

Re: how to load ONE file automatically from a folder containing sequential files?

[ Edited ]

Because List Array returns files alphabetically I think you will run into problems with your version if you have files Picture 99.jpg and Picture 100.jpg or things like this.

 

 Logically 100 was saved after 99, but your vi will return 99

Message Edited by elset191 on 06-05-2009 10:10 AM
--
Tim Elsey
LabVIEW 2010, 2012
Certified LabVIEW Architect
Member
Raymond99
Posts: 5
0 Kudos

Re: how to load ONE file automatically from a folder containing sequential files?

Tim, you're right, my code only works when picture's name has number less than 99, I switched to you code and it works well.    Raymond