help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Find the Max Value in a Vector


From: Joanna Cheng
Subject: Re: Find the Max Value in a Vector
Date: Wed, 8 Feb 2012 15:38:34 +1100

On Wed, Feb 8, 2012 at 1:15 PM, Michael Davidson <address@hidden> wrote:
I have a (200:1) vector x1, and I want to find the maximal value in the vector.  It seems like max(x1) should give me the max value, but no, it's not even close to the right answer from manual inspection.  Hmmm.  Maybe that's the index into the row vector where the max is stored?  Although that makes no sense for a vector that isn't a row or column vector.  Nope.  That's wrong, too.  Is Octave capable of telling me the max value stored in a vector?  I've tried what the 'help' page says should work, but I think I just need to go buy Matlab.

Works fine for me. What version of octave, on what OS? Could you provide a test case?

octave-3.2.4.exe:24> x=rand(20,1)
x =

   0.570176
   0.908796
   0.815253
   0.437041
   0.244348
   0.840917
   0.212318
   0.019978
   0.042693
   0.551441
   0.607535
   0.701187
   0.235667
   0.456407
   0.046169
   0.366124
   0.199947
   0.174513
   0.299213
   0.532349

octave-3.2.4.exe:25> max(x)
ans =  0.90880

Kind regards,
Joanna

reply via email to

[Prev in Thread] Current Thread [Next in Thread]