octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #41888] fminsearch: should pass additional arg


From: David Spies
Subject: [Octave-bug-tracker] [bug #41888] fminsearch: should pass additional arguments to called function
Date: Fri, 21 Mar 2014 16:54:20 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:28.0) Gecko/20100101 Firefox/28.0

Follow-up Comment #6, bug #41888 (project octave):

So it doesn't just mean that you have to explicitly give the value of that
parameter if you want to use the varargin?  That's what it appears to do. 
It's just like having multiple parameters with default values.  If you want to
give the value of some later one, then you have to give the values for the
earlier ones (even if they're the same as the default).
So for instance, as a convoluted way to find the square root of some number y

function [z] = f(x,y)
  z = abs(x .^ 2 - y);
endfunction

function [r] = takesqrt(n)
  r = fminsearch(@f, 1, struct(), n);
endfunction

AFAICT, this works fine.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?41888>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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