LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

acquiring continuous data from Ni DAQmx

Solved!
Go to solution

1.  Right click on the left hand shift register and select Create Constant.  You should be doing this anyway so that the graph clears when you restart the VI.

2.  Double click on the Express VI that converts the dynamic data and pick 2-D array of scalars, either row/columns are channels depending on the way the data comes out of the DAQ assistant.

3.  The build array will automatically convert to Concatenate inputs, but if it does not, right click and select it.

0 Kudos
Message 11 of 20
(2,569 Views)
Many thanks.
0 Kudos
Message 12 of 20
(2,566 Views)

I stored a data from a DAQ USB 6008, using icon called write to measurement file, there is no problem to read this file using a graph indicator but I want to read it as 1D array to select from it some data, I attached the VI could you please take a look.  

Could you please inform me about this problem.

0 Kudos
Message 13 of 20
(2,547 Views)

Hi,

I am very interested in this discussion, but, truthfully, I am very confused.  I also am collecting data continuously from a DAQ and I want to put the values in an array, and then, perform calculations on certain array elements each time the WHILE LOOP executes, i.e. each time the array is appended and made bigger.  In the picture you give here, is the array size specified?  How many elements can go into this array?

 

I really just want to compare the voltage value measured with each iteration of my WHILE LOOP to the previous measurement generated by the WHILE LOOP and then do something with that comparison.  Can I create an array of two elements and compare them?  My real question is how do I capture several measured data values, and then access them for some simple mathematical manipulation?  I have spent many hours looking through the LABVIEW HELP and, I cannot write code that is error free.  With the picture you have offered, how would I limit that array to TWO elements that can be compared and then move to the next cycle and compare two more, where one is the same as before, meaning...

 

Run WHILE LOOP and collect data point A

Run WHILE LOOP and collect data point B

Compare A to B and execute command based on comparison

Run WHILE LOOP and collect data point C

Discard data point A

Compare B to C and execute command based on comparison

Run WHILE LOOP and collect data point D

Discard data point B

Compare C to D and execute command based on comparison

etc....

 

This should be simple, I think, but, I cannot understand how the array  is built and accessed from continuous data collection.  I can't find good explanations of the functions of the terminals in the myriad of array functions on the pallette.  Can you suggest anything?  Is there a GOOD tutorial on arrays?  I have read a bunch of stuff, but, it doesn't really help me to understand how you actually wire the things together properly; the array stuff in Labview Help is pretty conceptual and leaves out a lot of details.  HEre is the simple kind of code I am trying to work with.  How do I just compare the most recent two values before doing the next WHILE LOOP interation?

 

Thanks,

Dave

0 Kudos
Message 14 of 20
(1,885 Views)

If you want to do something with an array that maintains data between loop iterations, then you should be using a shift register.  Since you don't seem to know about those, otherwise your VI would have had one in it already, I would recommend you start by looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 15 of 20
(1,880 Views)

Hi,

Thanks for the suggestion about the shift registers.  Actually, shortly after I posted that question, I realized the utility of the shift register for this application, and I wrote them into my VI.  They seem to be the best route for what I need to do.  Can you suggest any tutorials on the arrays, since, I definitely need some knowledge of the arrays for some data file generation that I will want to do shortly.  I am learning Labview for only the past 10 weeks or so, so, I am definitely on a steep learning curve at this point, and have spent many hours studying the tutorials and searching the Labview Help.

Thanks,

Dave

0 Kudos
Message 16 of 20
(1,874 Views)

I don't know what kind of tutorials that exist on arrays other than the basic LabVIEW tutorials.  Arrays are an important concept in any programming language.  What other programming experience do you have?

 

All I can do is suggest you turn on Context Help with Ctrl-H.  Look at each of the functions in the array palette and read up on what they are.  Use the detailed help for more information.  I would say the two most widely used functions are Index Array, and Build Array.  Replace array subset is somewhat common.  A lot of new LabVIEW users use Insert into Array, but usually mistakenly.  I'd say at least 95% of the time Build Array is the correct choice.

 

Also search for auto-indexing tunnels.

0 Kudos
Message 17 of 20
(1,869 Views)

Thanks, your advice is very helpful.  My other programming experience is with Fortran and Pascal, but, that was 20 years ago, so, I don't remember much in terms of syntax, but, the use of arrays and matrices is something I have done for many years in my engineering capacity etc.  I understand the significance of arrays in engineering, so, that is why I am interested in getting a good understanding of how to make the correct wirings in Labview with the various array functions.  I am just struggling to connect these array functions properly.  For example, does the Waveform Graph automatically create the array for the user  without the use of Build Array?  And then, what function would you use to select a given element from that array?  And how is it wired, and how do you view the elements of an array?  I can't find clear explanations of these kinds of questions in Detailed Help.  The Detailed Help gives conceptual explanations about how the various array icons function, but, doesn't include details of how to wire these things.

0 Kudos
Message 18 of 20
(1,861 Views)

@dav2010 wrote:

Thanks, your advice is very helpful.  My other programming experience is with Fortran and Pascal, but, that was 20 years ago, so, I don't remember much in terms of syntax, but, the use of arrays and matrices is something I have done for many years in my engineering capacity etc.  I understand the significance of arrays in engineering, so, that is why I am interested in getting a good understanding of how to make the correct wirings in Labview with the various array functions.  I am just struggling to connect these array functions properly.  For example, does the Waveform Graph automatically create the array for the user  without the use of Build Array? 

 

I'm not sure exacly what you mean.  Are you getting this by right clicking on a waveform graph terminal and picking create constant or create control?  The waveform graph can take many different datatypes (waveforms, waveform arrays, regular arrays, ...)  The array of double seems to be the initial default datatype for a graph terminal when you first lay it down in your VI.

 

And then, what function would you use to select a given element from that array?  Index Array.

 

And how is it wired, and how do you view the elements of an array?  You feed your array into the upper left.  You wire an index value to the lower left.  On the right you either get a scalar value of an element, or an array.  Wire an indicator there if you want to see it.  For a 2-D array going in, you can get either an element (if you wire up both a row and column index, or a row, or a column if you only wire up that index and leave the other blank.

 

I can't find clear explanations of these kinds of questions in Detailed Help.  The Detailed Help gives conceptual explanations about how the various array icons function, but, doesn't include details of how to wire these things.  Search the example finder for arrays.  Read lots of other messages in the forums and look at the VI's so you can see how other people use them.


 

0 Kudos
Message 19 of 20
(1,859 Views)

... For example, does the Waveform Graph automatically create the array for the user  without the use of Build Array? 

 

 

I'm not sure exacly what you mean.  Are you getting this by right clicking on a waveform graph terminal and picking create constant or create control?  The waveform graph can take many different datatypes (waveforms, waveform arrays, regular arrays, ...)  The array of double seems to be the initial default datatype for a graph terminal when you first lay it down in your VI.

DAVE: Sorry, I reviewed some examples that I had studied a couple months ago that involved a WAVEFORM GRAPH, and I now understand that the WHILE LOOP and the FOR LOOP automatically create an array with AUTO or ENABLE INDEXING.  This array can be sent to the WAVEFORM GRAPH and viewed after the LOOP has terminated, so, sorry I was confusing the LOOP with the GRAPH in terms of creating the array.  The LOOP creates the array and allows you to pass it through the tunnel to a graph.

 


Thanks again for your thoughts.  The few hint/suggestions you made helped me make some good progress in my understanding of array usage in LV. I'll keep working through the tutorials and examples.

0 Kudos
Message 20 of 20
(1,843 Views)