LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to combine data signals

I have a for loop that reads a USB device.  I want to combine all of the reads of the output "data".  I cannot figure out how to do that.  All I get is the last read in the loop.  I know this has been answered in other places, but I cannot find it.  Any help, please.

 

Screen Shot 2021-09-26 at 10.46.47 AM.png

0 Kudos
Message 1 of 5
(758 Views)

Two suggestions:

  • Post complete LabVIEW code (meaning a file with the extension .vi, not an image of a tiny piece of a block diagram).
  • For anything other than the simplest acquisition or output for the LabVIEW Beginner, do not use the DAQ Assistant.  Learn to use DAQmx VIs, instead.  Check out "Learn 10 Functions in NI-DAQmx and Solve 80 Percent of your Data Acquisition Applications".

Bob Schor

0 Kudos
Message 2 of 5
(745 Views)

Dear Bob,

 

Thank you.  I know it might be able to do it another way, but the current code works excepts it gets data only from the last pass.  If the data would combine my whole code with work.

 

To simplify, the problem I extracted the code.  The real code does compile.  If someone can tell me how to arrange the output so all loops are contained.  Then my program would be finished.

 

It is just that I do not understand the several techniques to deal with loops.

 

Howard

0 Kudos
Message 3 of 5
(720 Views)

What he said about not using express VIs.  Lets fix that first, right click on the express VI and choose convert to DAQmx code.  Now you have code you can see what is going on and modify as you need.  Since I do not use that type of express VI I am guessing that the output that says data is a cluster with a deltaT, To and a data array either that or a 2D array with time as the first column and data as the second.  Let's assume the former.

 

Here is the way that I would do it.  I would use the shift register.  Initialize it with a blank 1D array then inside the loop use build array putting the output of the shift register on top. do a cluster unbundle by name to select the data array and wire it to the bottom of build array.  Then right click on the build array and select concatenate inputs so that the output is also a 1D array.  Wire that array to the input of the shift register where you currently have the data going. 

 

On exit of the loop if you really want the data to be a cluster you can do a bundle by name and stick the built up data array into the cluster.

0 Kudos
Message 4 of 5
(715 Views)

I fixed the problem by converting the data to an array before the "For Loop" was finished.  I then used the "Concatenate".  This solution is inelegant but it works.

0 Kudos
Message 5 of 5
(698 Views)