LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D array output from mult channels into numeric indicators?

I have a set of thermocouples from which I am reading data via DAQmx. I've got a DAQmx function, type "Analog 2D DBL Nchan NSamp", which returns a 2D array of the samples for all the channels.

I would like to direct the output from each channel to a numeric indicator, so that I can watch the output changing for each channel. I need separate numeric indicators, because I need to position them on top of a graphic.

I am very new to LabView, and am somewhat puzzled as to how to take the 2D array of data from the Read function and get it split into the data for each channel. I was looking at the Index Array function, which seems to be possibly relevant, but I can't quite figure out where to go from there.
Poi
nters and pushes in the right direction very appreciated.
0 Kudos
Message 1 of 7
(3,993 Views)
Supposing you have a 2D array with n rows (for n channels) and m columns (for m samples), you can, of course, use an index array to extract either a given value or a whole column. Since you want to display the acquisition result in a numeric indicator, I suppose that the number of samples m is equal to 1.
Wire your 2D data array to the index array function, then wire a control, with the channel number i you want to display to the upper index and wire a zero constant to the lower index. You will notice that both index have turned black. The output of the function will be a single number (line i,column 0). That's it.

Now, if you have more than one sample, you will have to decide if you want either to display all the values (in this case you can't use a simpl
e numeric indicator !), or an average of all the readings for a given channel, or the last reading. Do not wire the lower index (stay blank). The Index Array function will return a 1D array of data (line i, all columns), that you can manipulate further to achieve your ultimate goal...
If you need more help, give us some more details.
Hope this help...
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 7
(3,993 Views)
Well, this answer makes clear to me that I am confused about what I don't understand. Based on this fine explanation, I do understand the array indexing, but I don't understand how I get a continuously changing set of samples from my DAQ Task . Perhaps I am going down the wrong path entirely?

What I am ultimately trying to do is continuously sample from N thermocouples, and display the changing results in N numeric indicators.
When I went through DAQ assistant to hook up to my instruments, and told it to generate example code, it created a DAQmx Read function (within a while loop) that hooked up to a waveform control.
I don't want to display a set of waveforms, I want to display the actual values, each in its own numeric indicator.
So I thought that
perhaps a DAQmx Read function that output an array of values was the right way to go, but I think now I am confused about how to read and display a constantly changing value. I'm sure a loop is involved here somewhere, and there is a while loop around the DAQ Read function, but I don't understand how I get the most current set of samples from the array. SHould I be using some other function?
Help gratefully appreciated. This is only now my second day dealing with LabView 🙂 so I am a bit confused.
0 Kudos
Message 3 of 7
(3,993 Views)
Send a copy of your vi, and I'll try to fix it with you.
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 7
(3,993 Views)
ok, maybe these 3 examples will illustrate my confusion. I am reading 9 channels of thermocouples, and trying to display the data 3 ways -- a) in numeric indicators b) in a multiplot graph and c) in a stacked strip chart.

I am trying to figure out which of the polymorphic DAQmx Read functions to use -- attached are 3 of the four examples. What I am not getting is how to get the output from the Read function appropriately into the various indicators -- for any given Read function, only some of the indicators get the data correctly. I am especially puzzled about how to use the 2D array output correctly; I am sure I need some kind of data transformation, but I just don't get it.
Many thanks for any help.
Download All
0 Kudos
Message 5 of 7
(3,993 Views)
OK, I'm back...
I have a lot of problems downloading files here. That's why it took so long to answer your questions.

When you read n samples, on n channels, you get a 2D array of data.
You can slice this array to isolate a specific channel.
Then you can display either all the data (for instance, appending them to a graphic display), or you can average them (your choice will depend on the rate of evolution of the temperature, and on the noise level of the signals.
Of course, the simplest case (but not always appropriate : lower data output) is when you grab only one sample at a time.
You nearly did it in your various examples.
I have modified Foo2 and Foo4 (hope they work...). Foo3 was a dead end for a b
eginner (kind of 3D array...). Have a look at my comments inside, and relate the mods to my previous answer.
A chart indicator plots a series of consecutive data. Means that you had to extract the channel data (rows) before plotting them separately, or to connect them to the chart indicator after transposing the 2D array (like you did in Foo2).
Do not go to array manipulation with an empirical, random approach : Do some training on array manipulation, with simple tests on well defined example arrays, such as extracting a given line or colum, reverting the array, replacing a given cell and so on.
You have to be really confident in your knowledge of array manipulation, otherwise I promise you a really painfull life..
😉

Keep wiring !

CC
Chilly Charly    (aka CC)
Download All
0 Kudos
Message 6 of 7
(3,993 Views)
OK, I'm back...
I have a lot of problems downloading files here. That's why it took so
long to answer your questions.

When you read n samples, on n channels, you get a 2D array of data.
You can slice this array to isolate a specific channel.
Then you can display either all the data (for instance, appending them
to a graphic display), or you can average them (your choice will
depend on the rate of evolution of the temperature, and on the noise
level of the signals.
Of course, the simplest case (but not always appropriate : lower data
output) is when you grab only one sample at a time.
You nearly did it in your various examples.
I have modified Foo2 and Foo4 (hope they work...). Foo3 was a dead end
for a beginner (k
ind of 3D array...). Have a look at my comments
inside, and relate the mods to my previous answer.
A chart indicator plots a series of consecutive data. Means that you
had to extract the channel data (rows) before plotting them
separately, or to connect them to the chart indicator after
transposing the 2D array (like you did in Foo2).
Do not go to array manipulation with an empirical, random approach :
Do some training on array manipulation, with simple tests on well
defined example arrays, such as extracting a given line or colum,
reverting the array, replacing a given cell and so on.
You have to be really confident in your knowledge of array
manipulation, otherwise I promise you a really painfull life..
😉

Keep wiring !

CC
Download All
0 Kudos
Message 7 of 7
(3,993 Views)