cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Finding 10 largest values in a dataset

mackat-disabled
1-Newbie

Finding 10 largest values in a dataset

Hello everybody,

Would be most grateful if somebody would give me some pointers on how to do this in MathCad - if its even possible. I assume so because Excel can do it...

I have a long string of data in MathCad and want to find (say) the tenth largest value in the dataset. In Excel I would type '=LARGE(A1:A1000,10)' where A1:A1000 is my dataset and the number ten calls for the 10th largest value.

Can anybody indicate how to do this in MathCad please?

Thanks!
10 REPLIES 10

Prepare a vector v with the length of the strings. Then use csort(v,ORIGIN) and submatrix to take the last 10 values.

If you want the index positions, augment v with the numbers 1,2,3 ... rows(v) and use csort with the augmented matrix.

Regards. Alvaro.

Great stuff thanks!

Tom

On 11/24/2009 7:11:23 AM, mackat wrote:
>Great stuff thanks!
>
>Tom
_____________________

Find and locate in an array.

jmG



MikeArmstrong
5-Regular Member
(To:AlvaroDíaz)

I presume that the original poster has his answer but I thought I would post my effort anyway for interest.

Mike

There may be a direct matrix construct .

jmG

MikeArmstrong
5-Regular Member
(To:jeanGiraud)

jean Giraud wrote:

There may be a direct matrix construct .

jmG

I have slightly modified my function so it can now also handle matricies.

jmG - How do you create Gif images from Mathcad? When simple alterations are made it would be much easier to post the image so collabs don't have to download and unzip each file.

Mike

>jmG - How do you create Gif images from Mathcad? When simple alterations are made it would be much easier to post the image so collabs don't have to download and unzip each file< [Mike]
___________________________

There are several ways the simplest is to "Print screen" from Windows, copy/paste in Paint and clean, then copy /paste in IrfanView, reduce to 256 colors or in 16, 8 eventually colors depending upon how many colors, For 2d plots, 16 colors is enough because the 2d plot is based on the 16 colors. The point with Irfanview is that it is a simple 256 color reducer, and it does not work well if the 3D plot rich in colors is large size. My way of doing is as simple and lot more flexible . I select the regions in Mathcad copy, paste in Paint, clean organise annotate, select from Paint and paste in WinGrab, then reduce 256 colors. WinGrab has two color reducer options for the 256 level. It has "Octree" and Neural Kohenen. So, a 256 large size that IrfanView does not render, WinGrab renders . hat's on e point about WinGrab. The other superb feature of WinGrab is that if you have copy several section from any source [web, Mathematica, ... PDF] ,for the next successive captures, it uses the same selection rectangle. That is wondeful for copying with the same size and you can shift as well. Once I have my image from WinGrab, copy/paste in IrfanView and save in its own filing system. WinGrab is essentially a "capture tool". IrfanView a "saving tool", it has some image processing like sharpening, play with colors, inverse colors .... etc. Like you say: for a minor update of a work sheet, just pass the image. Doing so is compatible for all versions to appreciate the proposal.

_______________________________

The 10 largest values is a specific case that you can make from the general "collect" and sort, For the 10 largest in a matrix, you could scan based on the max(M) as a starting point. It wouldn't be flexible because the next day you want on a range in a matrix ... on the range: we have the tool. For the 10 largest in a matrix, better unwrap in a vector, sort and collect. This *.gif is 2 color levels saved as 8 levels in IrfanView.

This site has already improved, Mona is working hard on it [she looks like us : a bit fan of Mathcad]

1. The spell check takes my long message !!! [I cried for that, got it]

2. Yesterday , I have removed the work sheet "Critical region..." replaced by the newer version [same, I cried for it: got it]

........................

However: if I search for "Tag" can't find anything because can't read [insufficient contrast].

"Demandez pour recevoir". Your updated work sheet did download fine.

Zip saves 0 or little for Mathcad ws ... maybe convenient for the community data base ?

Jean

MikeArmstrong
5-Regular Member
(To:jeanGiraud)

Jean,

Thanks for your comments regarding producing a picture, some valid points. Will have a look at the software which you reccommend.

jean Giraud wrote:

_______________________________

The 10 largest values is a specific case that you can make from the general "collect" and sort, For the 10 largest in a matrix, you could scan based on the max(M) as a starting point. It wouldn't be flexible because the next day you want on a range in a matrix ... on the range: we have the tool. For the 10 largest in a matrix, better unwrap in a vector, sort and collect. This *.gif is 2 color levels saved as 8 levels in IrfanView.

The section above which has been highligted sums up why your function is a massive improvment on the function that I produced. Another function to file.

Cheers for the help.

Mike

Mike,

I understand that "10 largest values in a data set" might mean otherwise in your projects. Assume you have a matrix of levels of a surface cut flat with lot more than 10 max values [largest] ... would be quite embarrassing to locate 10 out of 101 [per say ] !!! You get my point . The attached "part of" will surely guide your request to be more supported for purpose [understanding you may be restricted in your description by some proprietary information].

Jean

MikeArmstrong
5-Regular Member
(To:jeanGiraud)

jean Giraud wrote:


would be quite embarrassing to locate 10 out of 101 [per say ] !!! You get my point .

Jean,

Good point and cheers for the worksheet. Maybe a little above my current Mathcad capabilities, but worth documenting.

It seems you have pre-wrote worksheet for every problem posted - well every problem I have ever posted.

Mike

Top Tags