LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

going through all elements in array

Hi there,

 

This problem has been getting to me and I know the answer is right in front of my face, so just wondering if someone can help point it out for me? 🙂

 

I have a folder of files (txt, tdms, etc) and my code is set up to report back all the files on the folder and number of files as an array. Then I want to be able to go through each element 1 by 1 and use each sepearte element later on.

The idea is I will have a folder where new files are constantly saved and I was this program to check the folder (in case it has been updated) and then for me to be able to use the new files as well. (eventually i will assign each element in the array to the end of a path so that each file will be called as the system goes through the array).

 

I've tried this with a for loop, as in standard text based programming that is the go to way but when I run it like this in labview, it doesnt look like the system is running through the array. Is this just becaus eit is happening so fats,, it wont show on the front panel or have I missed something? I have attached the code 🙂

 

Kelly

0 Kudos
Message 1 of 3
(2,517 Views)

Kelly,

 

accessing each individual item in the array is possible by using an "auto-indexing" input tunnel. Right-click your input-tunnel and select "Enable Indexing" for this. It is rather strange that it is not already like this as for for-loops, auto-indexing is default. Please note that with auto-indexing input-tunnels, you don't need to conntect the "N" terminal. Also, the "Index Array" function in the loop is not necessary as well (in fact, it will create a wiring error).

 

Output-tunnels is the same... but in your provided example, the code will be "Rube Goldberg" as it does nothing else then to copy the array if you configure the output-tunnel to be auto-indexing. So this only makes sense, if you add some analysis functions in the loop which modify specific elements.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 3
(2,506 Views)

Hi Norbert,

 

Many thanks for your reply it is greatly appreciated. I will give that a try, that makes a lot of sense 🙂

 

Kindest Regards,


Kelly

0 Kudos
Message 3 of 3
(2,498 Views)