|
From: | Kai Torben Ohlhus |
Subject: | Re: standalone application (octave to c++): define anonymous function for nonlin_curvefit() |
Date: | Mon, 28 Jan 2019 14:20:52 +0100 |
On Mon, Jan 28, 2019 at 7:53 AM ola <address@hidden> wrote:I have tried to declare:
octave_user_function f = @(p,x) 1-exp(p*x);
but I've got 1) error: stray address@hidden in program and 2) error: ‘p, x’ was not
declared in this scope
Why the octave interpreter doesn't understand @ sign?
How to properly declare an anonymous function or how to write a function
that will return an object octave_user_function?
Should I provide any additional headers (include <???>) when declaring
anonymous functions?
Maybe there is another way to transfer user function (@(p,x) 1-exp(p*x)) as
an argument for octave::feval?
It would be really great if I could use this function. My ideas for a
solution are exhausted. I need your help.
-----
ola
--
does this help>>str1='@(p,x) 1-exp(p*x);'str1 = @(p,x) 1-exp(p*x);>>fh=str2func(str1)fh = @(p, x) 1 - exp (p * x)>> fh(2,4)ans = -2980.0start with a string use octave to convert it to a function handle and the use feval from c++--DAS
[Prev in Thread] | Current Thread | [Next in Thread] |