04-12-2012 10:00 AM
Given that you have to produce all 6 elements of the array at once (since you need to "feed" them into six MeanPtByPt separate routines), I think the simple Array-to-Cluster followed by Unbundle Cluster is much simpler than six Index Arrays with constants 0, 1, 2, 3, 4, 5 wired into each one (less messy, as well). Now, if you could do it in a loop ... [Hmm -- of course, here's another way that doesn't even need Index Arrays ...]
The outer loop isolates each sample point, giving you an array whose values represent the various channels. The inner loop does the averaging for each channel. If you want to average a particular channel, put a dedicated MeanPtByPt function inside its Case selector, else just wire straight through (you'll need a Default entry with a straight-through wire, so it can handle all the "Do Not Average" channels). This is certainly simpler and more straight-forward than my earlier Array-to-Cluster + Unbundle, followed by Build Array.
04-12-2012 10:03 AM - edited 04-12-2012 10:06 AM
Hi Bob,
"I think the simple Array-to-Cluster followed by Unbundle Cluster is much simpler than six Index Arrays with constants 0, 1, 2, 3, 4, 5 wired into each one"
Ever thought about resizing the IndexArray node? And (after reading the help) you could also omit the constants...
04-12-2012 10:06 AM
Citras,
I don't understand the format of your data. It does not seem to be a simple 2-D array of Dbls, but a more complex form. If I knew the structure of the data array, I could tell you how to "tease it apart" to process it. Take a look at my just-previous post, where I broke the 2-D array up into an array of "single-sample information", which (in the inner loop) I treated as though it, too, was a simple 1-D array of samples, one per channel. However, in your case, I'm guessing that the "sample" is a slightly more complex structure, perhaps a multi-channel Waveform (as I see "time" in your output). The trick is to simply break apart the inner "sample", feed each "channel" data into its own "averager", then reassemble it.
04-12-2012 10:47 AM - edited 04-12-2012 10:49 AM
@BOB Schor wrote:
I think the simple Array-to-Cluster followed by Unbundle Cluster is much simpler than six Index Arrays with constants 0, 1, 2, 3, 4, 5 wired into each one (less messy, as well).
The array-to-cluster-unbundle-dance is actually much messier than you think.
(Your point was slightly more valid in ancient LabVIEW version (4?) where "index array" was not resizeable)
Here's equivalent code. As you can see, (A) has several problems over (B) as listed.
04-12-2012 10:48 AM
@GerdW wrote:
Hi Bob,
"I think the simple Array-to-Cluster followed by Unbundle Cluster is much simpler than six Index Arrays with constants 0, 1, 2, 3, 4, 5 wired into each one"
Ever thought about resizing the IndexArray node? And (after reading the help) you could also omit the constants...
Gerd,
I don't understand your comment about resizing the Index Array node (I do know what this means), and, even after reading the help, I don't see how you can "omit the constants" if you want to present each array element to a separate "averaging" VI. Maybe you are thinking about doing the averaging in some other way (which is fine), but if you want to do point-by-point averaging, you need to get the points one-at-a-time.
Ah. If I have an array of 1000 samples of 6 channels, I can, of course, extract multiple 100-sample sub-arrays from each channel and pass them to a single (!!) Mean VI, giving me a way of processing the first 900 samples (this could certainly be done with dual-indexing the 2D array), but (a) you wouldn't process the entire array this way, and (b) it doesn't lend itself to "on-the-fly" processing (e.g. smoothing the data as it's being collected for showing on a display).
Now, I think I get it ...
04-12-2012 10:52 AM
Thanks! I didn't know this trick (this must be what Gerd was referring to -- I totally missed the point, nor was it obvious to me even after I read the Index Array Help message). I totally agree that this is a better method of pulling out all the array elements than my Array-to-Cluster + Unbundle!
04-12-2012 12:29 PM
Bob, You've been on the forums a long time. I'm surprised you hadn't seen an expandable Index Array before. Or the Array to Cluster in the Rube Goldberg thread.
04-13-2012 08:07 AM
All of your comment are very helpful, it´s working now..
Thx for the help, here some kudos