LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Average Columns in Array

Solved!
Go to solution

I borrowed this VI from another thread, which works perfectly for what I am trying to do.

 

http://forums.ni.com/t5/LabVIEW/Convert-tdms-to-lvm/td-p/738286/page/2

 

What I am trying to do is record some voltages, save them to a TDMS as well as a LVM file (which the above VI does).  The issue I am running into is I would like the converted LVM file to show an average of all the samples taken for each colum/channel.  In other words, just have one row of the sample averages instead of multiple rows of all the samples taken.  Since I didn't write this VI originally, I don't quite understand how it works and how to change it to just write the averages to the LVM file.  I was hoping someone could show or tell me what to do if it isn't too much trouble.

 

 

Download All
0 Kudos
Message 1 of 10
(12,343 Views)

you can use "index array" function to extract a specific row from an array. Leave the first index input unwired and to the second one down wire the row number you would like to extract (+1 since the array starts at 0)

0 Kudos
Message 2 of 10
(12,334 Views)

Hope this helps.

array column average.png


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 3 of 10
(12,328 Views)
Solution
Accepted by topic author MCHammer

Sometimes a quick search of the forum is all you need, for example from here.

 

Message 4 of 10
(12,320 Views)

So would this work for a 3D array as well? In other words, if the original VI uses n amount of columns, would this average each column?

0 Kudos
Message 5 of 10
(12,307 Views)

@MCHammer wrote:

So would this work for a 3D array as well? In other words, if the original VI uses n amount of columns, would this average each column?


No, it would average each plane because after the first indexing you get a 2D array. You can easily average each column with a little more code. Of course you also need to decide which direction you want to average, because there will be 3 different possibilities.

0 Kudos
Message 6 of 10
(12,294 Views)

Thanks for the pointers guys.  I managed to put together something that works from all the help.  I thought I would post it in case someone else has the same problem as me.

0 Kudos
Message 7 of 10
(12,287 Views)

That inner FOR loop makes no sense at all. You should get exactly the same outcome of you would delete it.

 

Don't hardwire N of the FOR loop, unless your array always has the same number of columns. Read the number of columns from the array size.

 

Where is Array 3 coming from? What is it's size?

0 Kudos
Message 8 of 10
(12,264 Views)

How did you get the "mean" inside the For Loop?

0 Kudos
Message 9 of 10
(10,765 Views)

Are you at all familiar with LabVIEW? Most likely you need to disable indexing on the array input tunnel.
.. But as we already said, the inner FOR loop is not needed.

0 Kudos
Message 10 of 10
(10,757 Views)