samer@4: function indices = argmaxv(v) samer@4: % argmaxv - multidimensional index of maximal element of array samer@4: % samer@4: % argmaxv :: [Size:[[1,E]]->A] -> [[1,E]] :- numeric(A). samer@4: % samer@4: % Returns the first maximum in the case of ties. samer@4: samer@4: [m i] = max(v(:)); samer@4: [ind{1:numdims(v)}]=ind2sub(size(v),i); samer@4: indices=[ind{:}];