help-octave
[Top][All Lists]
Advanced

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

Re: Use package in standalone programs


From: siko1056
Subject: Re: Use package in standalone programs
Date: Tue, 9 Jan 2018 01:07:05 -0700 (MST)

Zoltán Szabó wrote
> [...] is it possible to call an already existing m file? My m file has
> like 20 lines and it is using the mentioned signal package, it just
> returns a single string for me what I need to process within c++. So if it
> is possible to just run the m file instead of programming all the 20 line
> in c++ that would be really good. (Note: I am not allowed to execute
> octave cli binary for this, I need to embed octave in my application as a
> library.)
> 
> Thanks,
> Zoltan

Just a small note: for this mailing list we have the convention to bottom
post [1].

This should work as well.  By using the code of embedded.cc you really
invoke the Octave interpreter (like octave-cli does itself).  Therefore you
are allowed to parse and execute any octave code (scripts, functions,
classes, ... ).  Assume your script is `myscript.m` and available on Octaves
load path.  Then calling from C++:

```
octave::feval ("myscript", ovl (), 0);
```

should suffice.

HTH,
Kai

[1] https://en.wikipedia.org/wiki/Posting_style#Bottom-posting



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

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