LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using an array with a library function

I have a library function that I would like to use on the data in an array. My problem is that the function(which I am using as a subVI) will not accept an array as the input data. So I need to pass each element of the array through the function, and rebuild the array so it is in the same configuration that it started at. I am hoping that there is a easy way to do this in labveiw without having to use a formula node. Any help would be appreciated.

Amy
0 Kudos
Message 1 of 5
(2,367 Views)
The simplest way to do this is to put the function inside of a for loop. A for loop auto indexes an array so you just have to wire the array through the for loop and into the function. Anything wired out of a for loop is automatically made into an array.
0 Kudos
Message 2 of 5
(2,367 Views)
I tried to do what you suggested, but for some reason I still can not wire the indexed array to the subVI. The error I'm getting say that I've wired two terminals not of the same type. The type of the sorce is 2D array of long. The type of the sink is unsigned long. I find that error odd seeing that the array has been indexed. I've attatched my VI. What the for loop is trying to do is pass each element of the array through the subVI, then return an array.
0 Kudos
Message 3 of 5
(2,367 Views)
Your problem is because its a 2D array. When you index it you get a 1D array. Put another for loop around your subvi to index the 1D array and you should be all set.

Brian
0 Kudos
Message 4 of 5
(2,367 Views)
Thanks, I understand now.
Amy
0 Kudos
Message 5 of 5
(2,367 Views)