- #1
Don Carnage
Hi guys.
I need to locate the maximum value in an array in Perl. So let's say it looks as follows:
# Define array
my @a;
# Define inputs in array
a[1]=11;
a[2]=12;
a[3]=13;
a[4]=14;
a[5]=15;
a[6]=13;
a[7]=12;
a[8]=14;
Then I would like to do something like max[@a] given the result "15" and then
maxloc[@a] given the result "5"
The arrays I use have about 100,000-1million elements.
Hope you guys can help..
Peter.
.. and the worst thing is that this is so easy in MATLAB. Damn I hate that the MATLAB license is so expensive!
I need to locate the maximum value in an array in Perl. So let's say it looks as follows:
# Define array
my @a;
# Define inputs in array
a[1]=11;
a[2]=12;
a[3]=13;
a[4]=14;
a[5]=15;
a[6]=13;
a[7]=12;
a[8]=14;
Then I would like to do something like max[@a] given the result "15" and then
maxloc[@a] given the result "5"
The arrays I use have about 100,000-1million elements.
Hope you guys can help..
Peter.
.. and the worst thing is that this is so easy in MATLAB. Damn I hate that the MATLAB license is so expensive!