# how to sort out a maximum value in an array

## Recommended Posts

I wish to sort out from data obtained from a keithley meter in a 2d array such that I get the maximum of all both on the x and y- axes and get the product of the maximum values. I have tried to use the sort function but it just gives me the last value of the x axis and not the maximum of the x and the corresponding maximum of y. Could someone please help? Regards

##### Share on other sites
I wish to sort out from data obtained from a keithley meter in a 2d array such that I get the maximum of all both on the x and y- axes and get the product of the maximum values. I have tried to use the sort function but it just gives me the last value of the x axis and not the maximum of the x and the corresponding maximum of y. Could someone please help? Regards

In the array functions pallette is the Max and Min of array function. It returns the max and min of what ever you feed it and their indexes.

That seems so simple that I must be misunderstanding your question. Are you wanting to find all the local maxima and minima? That is trickier. I suppose you would need to define "local."

There must be a function or example to do that but I haven't used it.

Mike

##### Share on other sites

Yes, your request is a little unclear. Could you post a short 2D table of data showing exactly what you are trying to get? That will probably make it pretty trivial to give you the right solution/VIs.

In fact, the exercise of doing it in a table for us will probably show you how to do it yourself. If not we'll help.

##### Share on other sites

maybe this is the solution?

##### Share on other sites

Thanks for the solutions,

I have attached here a table as an example to illustrate. The table has collumns ABC, A and B are readings obtained from keithley meter and C is the product of A & B. C has a maximum value indicated at row labelled D (1.82E-1). I wish this to be displayed as the maximum of collumc C and also display the inputs of A and B that give this maximum.

I have also attached a block diagram to implement this but when I RUN the ARRAY MIN MAX returns the last value and not the maximum.

In the array functions pallette is the Max and Min of array function. It returns the max and min of what ever you feed it and their indexes.

That seems so simple that I must be misunderstanding your question. Are you wanting to find all the local maxima and minima? That is trickier. I suppose you would need to define "local."

There must be a function or example to do that but I haven't used it.

Mike

##### Share on other sites

Thanks for the solutions,

I have attached here a table as an example to illustrate. The table has collumns ABC, A and B are readings obtained from keithley meter and C is the product of A & B. C has a maximum value indicated at row labelled D (1.82E-1). I wish this to be displayed as the maximum of collumc C and also display the inputs of A and B that give this maximum.

I have also attached a block diagram to implement this but when I RUN the ARRAY MIN MAX returns the last value and not the maximum.

##### Share on other sites

or use "Sort 2D Array.vi" from http://www.OpenG.org to sort all.

Manfred

##### Share on other sites

Thank you

I am trying it out as I customise it in my VI

##### Share on other sites

[Thank you all, I managed to sort out the problem by placing the array index outside the loop that is creating the array.

Thank you all

Justus

##### Share on other sites
or use "Sort 2D Array.vi" from http://www.OpenG.org to sort all.

Manfred

Thnx a lot! That... 3912.llb really helped me. The main trick is to bundle two-dimensional array to the cluster.

##### Share on other sites

This seemed like the best solution for the problem!  Didn't think he was asking about sorting, just finding the max product and the associated inputs for the product.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×

×