From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stock in Array

Hi,

 

I've got the following problem:

Using the DAQmx, I receive data from 2 channels ( 0 and 1) at a rate of 10k. Now I would like to:

1) plot the data of both channel 0 and 1 ( this works)

2) Stock all the measured data in an array ( in which column 1 represents the data from channel 0 and column 2 represents the data of channel 1).

This means that, after the program has stopped, the array should be a nx2 array.

 

The type of the data is 'Dynamic'.

 

Anyone has an idea/suggestion/solution for my problem?

Thanks a lot!

0 Kudos
Message 1 of 6
(2,331 Views)

From DDT express VI to go from the blue wire to an array.

 

Use Build Array to build the values in an array.

 

Use a shift register to store the array between loop iterations.

 

Those 3 things should be all you need to know to figure out the rest.

Message 2 of 6
(2,327 Views)

I tried to do what you explained to me, but since I'm more of a beginner when it comes to LabVIEW this is what I created: ( see attachment)

 

It doesn't really work the way I was hoping it to do:

1) it only saves one channel into the array

2) it only saves up to 100 values and the starts to erase the first ones and overwrites them with other data.

 

Any suggestions?

Thank you!

0 Kudos
Message 3 of 6
(2,299 Views)

Your problem here starts with the fact you don't have the DAQ assistant, but you are trying to simulate what it does.  You really can't build an array of dynamic datatypes.  (Actually you can, but there is no logical basis to it.  It is not what the DAQ assistant puts out.)

 

I created a flat frame, the output of which simulates what a DAQ assistant puts out.

 

From there, everything is as I described in the previous message.

 

EDIT:

What I attached isn't working quite right yet.  It needs some work on how the arrays are combined, possibly some transpose arrays, or something.  Also, the loop needs a wait statement, it runs too fast right now.  But there should be enough information within what I attached to allow you to get further along.

 

Okay.  I fixed it.

Message 4 of 6
(2,292 Views)

The sinus and triangle were only meant as an example.


My main program is running on DAQmx but creating a smaller one to try whether the code worked or not looked easier to me 🙂

 

I'll try to implement the code in my main program and let you know if it works.

 

 

Thank you very much 🙂

 

EDIT: I can't connect the 'Build Array' with the shift register. Both of the 'inputs' in the Build Array are 2D array of double ( like in your example). The error given is:

You have connected two arrays of different dimensions.

The dimension of is 3

The dimension of Array is 2.

 

However, if I insert an 'Index Array' between the Build Array and the shift register the problem seems to be fixed...

0 Kudos
Message 5 of 6
(2,286 Views)

@DriesM wrote:

The sine and triangle were only meant as an example.


My main program is running on DAQmx but creating a smaller one to try whether the code worked or not looked easier to me 🙂

 

I'll try to implement the code in my main program and let you know if it works.

 

 

Thank you very much 🙂

 

EDIT: I can't connect the 'Build Array' with the shift register. Both of the 'inputs' in the Build Array are 2D array of double ( like in your example). The error given is:

You have connected two arrays of different dimensions.

The dimension of is 3

The dimension of Array is 2.

 

However, if I insert an 'Index Array' between the Build Array and the shift register the problem seems to be fixed...



Something is wrong with what you've wired up then.  Did you change the settings of the Build Array to "Concatenate Inputs"?

0 Kudos
Message 6 of 6
(2,274 Views)