Code covered by the BSD License  

Highlights from
maxloc

Be the first to rate this file! 2 Downloads (last 30 days) File Size: 1.49 KB File ID: #19331

maxloc

by Ben Barrowes

 

26 Mar 2008 (Updated 26 Mar 2008)

Replicates the functionality of maxloc in fortran.

| Watch this File

File Information
Description

%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)

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
maxloc Ben Barrowes 22 Oct 2008 09:55:15
fortran Ben Barrowes 22 Oct 2008 09:55:15
maximum Ben Barrowes 22 Oct 2008 09:55:15
location Ben Barrowes 22 Oct 2008 09:55:15

Contact us at files@mathworks.com