How can I find the index of the largest element of a matrix?

Is there a way to efficiently find the index of the largest element in a matrix. For example, if I have a matrix like:

1 3 9
2 4 5
1 3 3

The largest element is the [1, 2] element which is equal to 9.

1 Answer


The column index (ci) and the row index (ri) of the largest element  for the matrix 'x' can be found like this:
ci = maxindc( maxc( x ) );
ri = maxindc( x[.,ci] );



Your Answer

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.


Thank you for your interest in the GAUSS family of products.

© Aptech Systems, Inc. All rights reserved.

Privacy Policy | Sitemap