12-23-2011 11:01 AM
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
12-23-2011 11:21 AM - edited 12-23-2011 11:24 AM
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.
12-23-2011 11:44 AM - edited 12-23-2011 11:46 AM
Thanks altenbach
I have attached the vi to this post. I would really apperciate if you help me with this example. The min values should be 100, 1500 and 4000 and the max values should be 1200,2600,5400 so as u mentioned the output should be this 2D array
100,1200
1500,2600
4000,5400
12-23-2011 12:38 PM