04-15-2007 06:53 PM
04-15-2007 09:04 PM - edited 04-15-2007 09:04 PM
You should just use a for loop to index through each row of the array, and allow the mean function average the row, then rebuild the array.
Message Edited by Ravens Fan on 04-15-2007 10:06 PM
05-07-2009 07:29 AM
05-07-2009 08:56 AM
biddy wrote:
There is a much faster possibility by using matrix multiplication. The function is called "A x B". See also attached image. The speed was faster by a factor of 13.
Nice solution! Don't forget to divide by the number of rows (size of the vector) when using this method.
05-07-2009 09:02 AM - edited 05-07-2009 09:03 AM
Interesting behavior, though I found it to be limited. With larger arrays the time difference decreases, and actually reverses (with the AxB taking longer). At some point (in my case it was a 500x500 array) the A x B VI produces an out of memory error, but the Mean VI still works.
UPDATE: Make that 300x300. I actually got LabVIEW to crash on that AxB VI at that point.
05-07-2009 09:16 AM
05-02-2010 06:16 PM
Hi,
So I tried using the mean method given above, but the mean function seems to be thinking I am giving it a 2d array when I believe the for loop is just giving it a row. Can someone see if my syntax is a little funky? I may possibly be in the way I am building my array, which is being built in a for loop itself.
Michael
05-02-2010 08:35 PM
It is because you are creating a 3-D array, which becomes a 2-D array when you auto-index it at the for loop which has the mean function.
The problem is probably originating in your 3rd sequence frame. There you are taking a 1-D array and building it onto a 2-D array through the feedback node. But the output of the for loop is auto-index which means it takes every loop iteration of that 2-D array and makes it a 3-D array. I really don't know what your data means, or what you are trying to do, but I really doubt that is what you want.
05-02-2010 09:21 PM
Hi,
So that 1-D array contains strings of numbers in exponent form. What I am wanting to do is take that array and average it with the other 9 arrays (by row) that will get produced in the for loop. Does that make sense? I am having trouble figuring out the best way to store the data to do the averaging, which is why I thought of maybe taking the mean each time.
05-03-2010 04:32 PM
mcoughlin wrote:Hi,
So that 1-D array contains strings of numbers in exponent form. What I am wanting to do is take that array and average it with the other 9 arrays (by row) that will get produced in the for loop. Does that make sense? I am having trouble figuring out the best way to store the data to do the averaging, which is why I thought of maybe taking the mean each time.