Want to chk max of more than 2 numbers

I have 10 numbers

1 2 3 4 5 6 7 8 9 10

i want to chk Min of above number

Are you talking about elements of custom array?

EnableTextOutput(0);

matstr = "[3;10;5;8;1;2;6;4;7;9]";

mat = MxFromString( matstr ); // some custom array
printf( "Source matrix:\n" + MxToString( mat ));

sortedmat = MxSort( mat, 1 );
rownum = MxGetSize( sortedmat, 0 );

mmin = sortedmat[0][0];//minimum
mmax = sortedmat[rownum-1][0];// maximum

printf( "\nSorted matrix:\n" + MxToString(sortedmat));
printf( "\nmin: %g, max: %g", mmin, mmax );

955


If you are talking about 1-dim array then see Lowest(),LowestSince(),LLV(),Highest(),HighestSince(),HHV() functions.

In additions see Min(), Max() functions.


You need to be more precise about where are those numbers resulting from.

3 Likes

You can nest Max function to get max of more than two numbers

Max( Max(5, 6 ), Max(7, 8));

4 Likes