LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get the second high index from array max and min

Solved!
Go to solution

firsthly, thanks for your new attachement.

 

secondly i know your post is 7 years old!!! but i was lookind desperately for a method like that and i could not find anything... i asked you to upload the .vi because i do not understand the wirning and if you have used the subarray function ..

 

i am trying to do it in my vi but there are errorsSmiley SadCapture.JPG

0 Kudos
Message 11 of 19
(2,906 Views)

Your comparison results in an array and you cannot wire an array to a select function.

 

(What are you trying to do with my bilinear interpolation :D)

We don't typically debug pictures. If you want help, attach the actual VI.

0 Kudos
Message 12 of 19
(2,900 Views)

I  will also use the intepolation because i want to depict the values more precisely ... anyway this VI is just a scratch for my Keithley2000 VI which is more complex!!

 

 

i attach the vi ....

 

 

0 Kudos
Message 13 of 19
(2,898 Views)

I understand that this is a very old solution by Ravens, but the problem with resizing the array is that you need extra logic to keep track of the index locations and it will NOT work for 2D arrays!.

 

It is easier to just replace the largest with -inf, keeping the array in-place and indices constant. (Delete from array can be also very inefficient, because all higher elements need to be moved in memory because arrays are always contiguous). Here's what I would do. It can easily be adapted for higher dimension arrays. try to modify it for a 2D array!

 

LargestAndSecondLargest.png

 

 

Message 14 of 19
(2,895 Views)

@Angela93 wrote:

 

i attach the vi ....


OK, please explain what the code on the left is supposed to do with the 2D array. You seem to be taking the max of the full 2D array and then the max of the first row. What is the logic and reasoning behind it? What are you trying to get out of it?

 

The original problem of this thread is how to get the indices and values of the largest and second largest elements from a 1D array. If you want to do the same with a 2D array, you need to use my approach as I already said.

 

LargestAndSecondLargest_2D.png

Message 15 of 19
(2,893 Views)

HEY, I  will check it now but the only function i dont find is that in the red circle. is the replace array subset?Capture.JPG

0 Kudos
Message 16 of 19
(2,878 Views)

@Angela93 wrote:

... replace array subset?

yes

 

(It won't look like that in the palette, but once you wire a 2D array to it, it will look the same)

0 Kudos
Message 17 of 19
(2,873 Views)

dear altenbach thank you very much for your help about the vi to find the 2 minimum values ..it worked!!

 

however , for my main VI project ( i want to depict the RESISTANCE  values FROM 9 NTCS)through keithey2000 DMM to an intensity graph,  i am  using your amazing interlation VI and by adding some features of mine i get a not good enough result ... please if you have any suggestion it would be very heplful!!2.PNG3.PNG

0 Kudos
Message 18 of 19
(2,841 Views)

@Angela93 wrote:

...  i am  using your amazing interlation VI and by adding some features of mine i get a not good enough result ... please if you have any suggestion it would be very heplful!!


Please define your definition of "good enough". What do you actually expect? A 3x3 array does not have much information, no matter how hard you squeeze. 😄 Turning 9 elements into 14400 elements does not generate new insights.

 

You should also size the graphs so they have square elements and readjust dx and dy for the new axes.

 

If you want help, attach the latest VI again. We cannot debug pictures.

0 Kudos
Message 19 of 19
(2,826 Views)