LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find more than one min and max in 2D array contain 0 rows

Hi

I have a 2D array and I would like to find the max and min elements between series of 0s. As you can see in the picture If I remove all 0s from the array and use the max and min function then I will have just one min and one max but I need to find min and max after every 0 rows so you can see from the picture ( just as an example) I will have 3 min and 3 max numbers. Would you please help me with this code. Do you now any algorithm that can find min and max between 0s?

 

I have also attached my code to remove 0s and then search for max and min numbers but as I mentioned I need min and max for every part

Many thanks

Download All
0 Kudos
Message 1 of 4
(3,124 Views)

Can you attach a sample VI containing a typical 2D array as a diagram constant. 

 

You don't neet to remove anything. SImply autoindex over rows and keep track of the min and max in a shift regsiter. Whenever a row is zero for the first time, add the current min/max to an array and reset the min/max ro +inf/-inf at the next nonzero row. 

0 Kudos
Message 2 of 4
(3,117 Views)

Thanks

0 Kudos
Message 3 of 4
(3,111 Views)

Maybe something like this? I am sure it could be simplified....

 

 

0 Kudos
Message 4 of 4
(3,098 Views)