Showing results for 
Search instead for 
Did you mean: 

4D array averaging - I give up....!

Go to solution

Hi all, 


This might be a typical Friday afternoon question, but I've been stuck on this now just about all day and rather close to throwing the laptop out of the window. 


The case is as follow

* I've sorted 5 markers in a 4D array whereby I have 5 volumes

* Each volume (marker) contains data 5 datasets in 5 pages 

* Each dataset is build out of rows and columns of varying lengths (within 10% of each other) but similar amount of columns. 

* Each columns is another measurement channel


The amount of markers and repeats as well as measurement duration of markers is variable. 


I'm now trying to automatically average each channel data (column) with the other relevant channel data within one marker. 


So, for example, I would like to create an average graph (+ stdev) of channel 1, for each marker. 


I have attached an example array for reference, I'm using LabVIEW 11.0.1f (yes I know it's acient!) and would really appreciate your help!


Many thanks





0 Kudos
Message 1 of 8

Can you post an example of how you're doing your indexing?

This should be pretty straightforward.

How do you want the nils handled in your average?

Have you tried indexing columns and running them through the Mean and Std Dev functions?

0 Kudos
Message 2 of 8

Taki1999 wrote:

This should be pretty straightforward.

That's exactly what I thought! But I am struggling with the indexxing of the different levels of this array, hence I'm posting. 


I was hoping to remove the nils in order not to let them count towards the average



0 Kudos
Message 3 of 8

Post what you've got.

My guess is that you're missing a transpose or something like that.

0 Kudos
Message 4 of 8

I would suggest building a second array with the labels of each point (V1-P1-C1-D1, V1-P1-C1-D2, etc. You can do this programatically with string functions), not the points themselves. That way, when you manipulate one, manipulate the other likewise, and you will know what you've done.




To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 5 of 8

@Taki1999 wrote:

Post what you've got.

My guess is that you're missing a transpose or something like that.

This is what I'm now looking at, not very useful as I just started over, but gives you the general idea

0 Kudos
Message 6 of 8

Well you have the obvious race condition here. 


That cannot be helping you at all! 


after that you might just want to peruse the Rube-Goldberg thread over on "Breakpoint"  I'd bet kudos that the same thing could be done on a block diagram the size of a postage stamp.

"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 8
Accepted by Paddy1985

Your averaging isn't too far off unless I'm misunderstanding what you're trying to average.

Autoindexing is your friend.

Start by autoindexing on the volume/marker (outermost for loop)

Then autoindex into the page/dataset (1st level nested loop)

Then transpose your data set so that the next level will loop over columns.

Then autoindex into each column.

Strip trailing zeroes and pipe through the Std Deviation and


Auto index out your results for Std Dev and Mean and you've got a 3-D arrays where first index is marker, 2nd index is dataset, and 3rd is column.

Message 8 of 8