The application of "find", "max" and "min" functions in Matlab

Status
Not open for further replies.

cedance The application of "find", "max" and "min" functions in Matlab

hi,

pretty easy code.

there are functions in matlab. the "find" function along with "max" and "min" can be employed to get what u desire for. even find is not necessary unless u want to get the index of those values..

suppose ur matrix is a = magic(5);

then max(a) will list out 5 values, with each value the max of the columns of "a". check it out for better understanding. and if u take the max of this value, u get the max value of the matrix. that is , max(max(a)) will give the max element of the matrix. similarly min(min(a)) will give teh minimum of the matrix.

and then reg. the ascending order, if u want to sort the matrix rows each in ascending order, then u could use the matlab command, sort(a,2)

suppose u wanted to ascend column wise the mattrix a, then just sort(a) or sort(a,1) is enough.

and incase u want to arrange descend, then sort(a,2,'descend') is the syntax.

reg. printing.. u could save the output to a file and then print it.

hope ths s wat u asked for and it cleared. my wishes.

/cedance

Points: 2