LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reduce 2D array

Hello all,

I am very new to LabView and I have a read VISA and counter that are asynchronous.

I need help reading a row from a 2D array (file) then manipulate as follows.

The picture show indices 0,0,1,1,1,1,2,3,3,3,4,4,4 and their respective values

 

My end result should be 0,1,2,…and their averages

 

I think I need to use conditional statement as follows

If row(i,j) equals row(i-1,j) then take average of direct result into a array

Else

 

Thanks

0 Kudos
Message 1 of 8
(3,182 Views)
You should use a WHILE structure (containing the conditional structure) with two shift registers: one for the input array and one for the output array.
I think it's not difficult to implement.

bye
manga
0 Kudos
Message 2 of 8
(3,156 Views)

Hi,

I think this solves your problem.

Message 3 of 8
(3,148 Views)

Thank you both it's slik it worked Smiley Very Happy

 

0 Kudos
Message 4 of 8
(3,131 Views)

I made a quick modification to KC's example (LabVIEW 7.1). It fixes incorrect behavior if there are no entries with a zero in the first column. (KCs will produce a line with [0, NaN]. I am not sure if this situation can occur in your data).

The VI assumes that the 2D array is sorted by the first column. Is this always true? (It would be easy to change so it also works if things are not sorted that way).

Message 5 of 8
(3,111 Views)
Thank you all,
 
I forgot to mention that I am using lab View 6.1
Have good weekend
 

Message Edited by MZD on 10-14-2005 04:27 PM

0 Kudos
Message 6 of 8
(3,102 Views)
Here's mine in version 6.1. 🙂
Message 7 of 8
(3,091 Views)

Here is the code that generated the asynchronous array above.

I was trying to continuously read a voltage signal and record and index it as I specify with the capture button-snapshots like.  

0 Kudos
Message 8 of 8
(3,058 Views)