LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Manipulating 2D arrays

I'm fairly new to labview and working on a VI that I am taking over.
The VI has channels 0-31 (channels 0-3 are being used for a photo sensing diode).  In a while loop I am oversampling data at 1000 points/sec and the plan is to average 1000 pts and plot only the average per second.  I have a 2D array being piped out of the DAQmx Read (Analog 2D DBL NChan NSamp).  I am assuming the 2D array is the channel numbers and the data for each iteration.  I figured I'd transpose the array (to get the channel numbers in a row so I can isolate it), take 2 array subsets, one with index 0 and length 1 (I think this is wrong but I figured I would just get the first row and only the first row, but I seem to get an output of a 2D array), and the other with index 4 (since I don't want the photo diode channels) with no set length so it will take all the remaining data values.  Then I transposed the latter array so I can take averages of the elements.  I am thinking I get a column of averages of channels 4-31.
So now I have a row of my channels from 0-31 and a column of averages from 4-31.  The data needs to be thrown back into a 2D array to be written to the file.  Currently the output of the DAQmx is split and piped to an index array function that sends the photodiode channels to lock-in amps and straight down to be written to the file.
What can I do?  I am confused and obviously don't know enough to complete my task.  Any help is greatly appreciated. 🙂
0 Kudos
Message 1 of 7
(3,651 Views)
Somehow, your attached images bears little resemblance to your description? Where do you average the data? Many things don't really make sense and are overly complicated (e.g. you use a switch and two diagram constant to simply invert a boolean).
 
Can you attach a simplified version of your VI instead, e.g. using simulated data?
0 Kudos
Message 2 of 7
(3,632 Views)
First off, I didn't create this VI, so I am really confused as to what is going on.  So I agree.  And the picture was just to show where I am starting from.  My ideas haven't been implimented, for reasons such as...I don't know much of what I'm doing.  I know it's a pain when someone as new to labview as I am posts questions.  The person who worked on this VI moved and it's part of an ongoing research project.  So a newbie like me was thrown into it, and it's a steep learning curve!  The data that is split out of the DAQmx (that just goes down to the file) is what I need to average.  I expected a 1D array of just one data point per channel to come out of the DAQmx but I get a 2D array.  So I am really confused.  Thanks for looking at it anyway.  I don't think I can really say much more other than the basics that I just need to take that 2D array and average the oversampled data.  One application is that we are taking temperature data and there is a lot of noise so we need to average those channels.  And since the other channels will be used eventually, we just wanted to average each channel, and throw it back into a 2D array.

I can post the VI when I go back to the lab tomorrow if that might help, but I'm quite lost.
thanks again,
nathan
0 Kudos
Message 3 of 7
(3,627 Views)
hehe. I feel your pain. 😉
 
Is the current VI actually runnable? What are the dimensions of the 2D array, e.g. just (N x 1) for example?
 
Whatever you are trying to to, will probably be quite easy. we just need to know exactly in what form the data arrives. 🙂
0 Kudos
Message 4 of 7
(3,625 Views)
Is there a way I can see what exactly the 2D array looks like?  And it it does give me a column of the channel numbers and a column of data for each loop, can I just grab a column to manipulate?  I just want to average the string of data for every loop.  Seems really easy, but I am having trouble still.  I figure I'll get it soon, but if I could just make sure the data is how I expect it, that would help a lot!  Thanks!
0 Kudos
Message 5 of 7
(3,602 Views)
Just right-click on the 2D array wire and select "create indicator".
0 Kudos
Message 6 of 7
(3,596 Views)
Thanks!  You were right.  Once I put an indicator to actually see what the array looked like, all I needed was a simple for loop with a mean function, and I threw that back into an array.  Problems can be quite simple once you understand what's going on!  
0 Kudos
Message 7 of 7
(3,544 Views)