LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use list of data in an array as an input?

Hi,

 

I had an array with quite a number of complex data in it. I wanted to use it as an input to a function and plot it. I want the data in the array to be input one by one start from the top of the array till the bottom and feed it to the function accordingly. I'm having problem to do this. I tried 'for loop' but it will only output it after the loop finish running which not really desirable as the output from the function are to be use in other function and this introduce lagging. Any other method?

 

0 Kudos
Message 1 of 11
(2,913 Views)

It's hard to give you any help unless you post some code so we can figure out what you are trying to do. Smiley Wink

0 Kudos
Message 2 of 11
(2,898 Views)

Please mention what type of array it is? Is array of string/float/integer/cluster...etc. Is it 1D or 2D or 3D array????

 

What & how you want to plot?

0 Kudos
Message 3 of 11
(2,888 Views)

it just a normal 1D array contains integer.

 

exmp: let say

 

array: 10, 20, 30, 40

function: transfer function

 

I want to send choose 10 from the array and send it to a transfer function and plot the first output.. then repeat the process by choosing 20 from the array and send it to the transfer function and plot the second output.. then repeat it again till the end of the array.

 

At this moment I could not find a method to automatically choose the element in the array.

0 Kudos
Message 4 of 11
(2,881 Views)

I have attached the vi. Is this u want. What do u mean by Transfer function?How u r trying to use it.

 

Please upload ur code to understand this part.

0 Kudos
Message 5 of 11
(2,875 Views)

Yeap.. thats the problem. I used this for loop before but it only update the value within the loop.. To use the transfer function I need to use another loop called Control and Simulation Loop. Attached is the modified file. I tried using global or local variable but it wont update until the for loop finish all the iteration which only gives out the final value in the array to the transfer function.

0 Kudos
Message 6 of 11
(2,873 Views)

Why don't you use ur Control and Simulation Loop inside this FOR loop & pass one element to it .Then pass it to funcion then plot it & then go for 2nd element.

 

I'm not havin the toolkit to open VIs inside the Control and Simulation loop.

0 Kudos
Message 7 of 11
(2,864 Views)

This following picture is what kekin is referring to.  Your use of the local variable is improper.  There was no timing sync between writing to the Numeric and reading its local variable.  By puting the timed loop inside the for loop, and using a wire directly from Numeric instead of a local variable, you are now assured that you will be getting the correct data on each loop iteration.

 

22609i2CB5F751B0A02D0E

- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 11
(2,842 Views)

there for if I arranged it in that way, all the elements in the array get sent one by one to the transfer function during the 10s duration right?

0 Kudos
Message 9 of 11
(2,828 Views)

Not quite.  Only one array element will be retreived per loop iteration.  So the first element will be sent into the timed loop.  The timed loop will do its processing for however many seconds you have it set for.  Then the next loop iteration will extract the next array element and feed it into the timed loop.  If this is not what you want, please explain better.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 10 of 11
(2,813 Views)