07-21-2015 11:06 AM
Hello,
I am currently attempting to run hundreds of text files through my VI by only having to run the VI once and having labview open each text file in numberical order that are contained in a single folder.
Typically, I run each file one at a time through the VI, taking hours to run all the text files through. I was wondering if there is a way that I can specify a target folder and then each text file from the target folder will be opened and ran through my VI in numberical order (each file is in order i.e. MM_01, MM_02, MM_03...). Currently I open one file at a time, run it through "read from spreadsheet", then index the array, and run it through filters etc. to obtain the data I require. I am hoping there is a way to do this, as it will save days worth of work.
Thank you in advance for your help.
Solved! Go to Solution.
07-21-2015 11:11 AM - edited 07-21-2015 11:12 AM
07-21-2015 11:12 AM - edited 07-21-2015 11:14 AM
Are you just wanting to read all of the files within a folder then close them again after getting the data?
Just use the List Folder VI from the File IO pallette. You can input a pattern like "*.txt" to get all files of a certain type within that folder. Then fun that array of filenames into a For loop, Build Path with the original folder path, and Read from Spreadsheet.
Edit: Do what JeffP gave you. If you don't want the files within subfolders, do this:
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
07-21-2015 01:52 PM
Thank you for a quick response.
How do you suggest i resolve the issue of different data types in order to use this function? I have tried a few different ways and have whenever I adjust, it wont run through my sub VI's correctly due to being different data types.
07-21-2015 01:55 PM - edited 07-21-2015 01:58 PM
What different data types? The For loop is indexing through the array one by one, so you don't need to do an Array Index operation.
The snippet I included above should make it clear what to do once inside the For loop.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'