Mercurial > hg > mauch-mirex-2010
annotate _FullBNT/KPMtools/argmax.m @ 9:4ea6619cb3f5 tip
removed log files
author | matthiasm |
---|---|
date | Fri, 11 Apr 2014 15:55:11 +0100 |
parents | b5b38998ef3b |
children |
rev | line source |
---|---|
matthiasm@8 | 1 function indices = argmax(v) |
matthiasm@8 | 2 % ARGMAX Return as a subscript vector the location of the largest element of a multidimensional array v. |
matthiasm@8 | 3 % indices = argmax(v) |
matthiasm@8 | 4 % |
matthiasm@8 | 5 % Returns the first maximum in the case of ties. |
matthiasm@8 | 6 % Example: |
matthiasm@8 | 7 % X = [2 8 4; 7 3 9]; |
matthiasm@8 | 8 % argmax(X) = [2 3], i.e., row 2 column 3 |
matthiasm@8 | 9 |
matthiasm@8 | 10 [m i] = max(v(:)); |
matthiasm@8 | 11 indices = ind2subv(mysize(v), i); |