Home > m > helper > ltpda_getmax.m

ltpda_getmax

PURPOSE ^

LTPDA_GETMAX get the index and value of the maximum

SYNOPSIS ^

function [index, max] = ltpda_getmax(a)

DESCRIPTION ^

 LTPDA_GETMAX get the index and value of the maximum 
 value in an array
 
 function [index, max] = ltpda_getmax(a)
 
 M Hewitson 26-01-07
 
 $Id: ltpda_getmax.html,v 1.1 2007/06/08 14:15:10 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [index, max] = ltpda_getmax(a)
0002 
0003 % LTPDA_GETMAX get the index and value of the maximum
0004 % value in an array
0005 %
0006 % function [index, max] = ltpda_getmax(a)
0007 %
0008 % M Hewitson 26-01-07
0009 %
0010 % $Id: ltpda_getmax.html,v 1.1 2007/06/08 14:15:10 hewitson Exp $
0011 %
0012 
0013 
0014 max = a(1);
0015 index = 1;
0016 
0017 for k=1:length(a)
0018   if(a(k) > max)
0019     max = a(k);
0020     index = k;
0021   end
0022 end
0023 
0024 
0025 % END

Generated on Fri 08-Jun-2007 16:09:11 by m2html © 2003