[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Most elegant way to pass parameters to functions that are used as handle
From: |
rocketsound |
Subject: |
Most elegant way to pass parameters to functions that are used as handles? |
Date: |
Wed, 15 Jul 2015 13:14:58 -0700 (PDT) |
For example take the fmincon function (currently only awailable in Matlab)
doc fmincon <http://de.mathworks.com/help/optim/ug/fmincon.html> . It takes
two handles: one for the objective function and one for the constraints.
I'm curious about what you think is the most clean and efficient way to pass
parameters I use in those functions used as handles.
At the moment I'm stuck with two solutions:
1) Use global variables, a very bad solution
2) Use nested functions, but because of the odd scoping rules I have to
declare all variables I use like in the good old C times and I somehow
dislike this
3) ?
--
View this message in context:
http://octave.1599824.n4.nabble.com/Most-elegant-way-to-pass-parameters-to-functions-that-are-used-as-handles-tp4671665.html
Sent from the Octave - General mailing list archive at Nabble.com.
- Most elegant way to pass parameters to functions that are used as handles?,
rocketsound <=