LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continous output from a for loop

Hi Friendly Friends,

Could someone help me a with a simple query regarding labview . i would like to get continous output from a for loop for every iteration(1 sec interval) of the loop. The idea is to read a text file and for each iteration of the loop i should get the each line/ subset array . the reason i didnt want to have an indicator inside the loop is that the output from this array should be wired to a DAQ configured in a different VI with different ports, digital , analog and so on.

so could someone help me with this query ?

 

Thanks in advance 

 

I have attached the sample vi

 

0 Kudos
Message 1 of 7
(2,821 Views)

Put your DAQ code inside the FOR loop. Simple as that.

 

(currently your code does not make a lot of sense. Does the file always contain exactly five rows? If so, why do you wire a 5 to N? Not needed. If not, why are you wiring a 5 to N, discarding all other rows? Why are you writing 1D arrays with different lenghts to an outtoindexing output tunnel? they'll be padded to the longest array with zeroes.)

0 Kudos
Message 2 of 7
(2,814 Views)

Hi,

i used value 5 for the N just as an example . i would have a text file with 100 rows , so the idea was to read each row evry 1 second and pass it to a different VI for futher data manipilation . is there any other approach i could do to get the real time data out of the loop ?

 

Thanks

0 Kudos
Message 3 of 7
(2,796 Views)

@JGJ27 wrote:

 is there any other approach i could do to get the real time data out of the loop ?


Reading data from a file is not "real time data".

There are plenty of ways, e.g. queues. What have you tried? Can you give a more specific example of your code architecture? 

0 Kudos
Message 4 of 7
(2,781 Views)

i have attached a screenshot the sub VI . (In the Existing VI) As you can see the array named Black Zone list which will contain 5 columns of data which needs to be entered manually for a laser modulation project and X and Y signal are directly read from external files . so now insted for entering the black zone list manually i will be provided a file which contains 5 columns and 100 rows, from which i need to read each row every second and pass through the check statements and to the digital output . so when i run it with laser modulation. i will get really good pattern that moves around.

 

X1   X2  Y1  Y2   LaserIntensity

0      1     -1   1       1                      -->   feed first row to the for look check condition , after 1 second move to next row and so on 

-1     1     -2   2       1

-2     1     -3   -4      0

0 Kudos
Message 5 of 7
(2,767 Views)

You code contains an immense amount of unecessary code. Did you know that index array is resizeable? Did you know that you could autoindex on the 2D array, automatically getting one row per iteration (no need to get the size and wire N)

 

It would help if you could attach the actual VI instead of a picture. You are currently now showing what goes to the hardware?

 

Why can't you just parse the entire file at once, then playing the processed results back at 1s intervals later? For all practical purposes, parsing the file is infinitely fast. It does not need to be in sync with the experiment.

0 Kudos
Message 6 of 7
(2,745 Views)

Hi JGJ27,

 

Is everything all right or do you need more help?

0 Kudos
Message 7 of 7
(2,678 Views)