File Exchange

image thumbnail


version (1.49 KB) by Ben Barrowes
Replicates the functionality of maxloc in fortran.

1 Download

Updated 26 Mar 2008

View License

%function out=maxloc(x,dim)
% Replicates the functionality of maxloc in fortran.
% INPUTS: x -> data variable
% dim -> (optional) dimension upon which to operate
% (same in Fortran and Matlab)
% OUTPUTS: out -> set to second output of Matlab's max() if dim is specified
% otherwise, is the maximum location for the entire array
% returned as a cell array resulting from ind2sub
% this could then be used as a subscript list
% EXAMPLES: a=magic(5); b=maxloc(a); a(b{:}),b
% b=maxloc(a,1)

Cite As

Ben Barrowes (2020). maxloc (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (0)

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux