help-octave
[Top][All Lists]
Advanced

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

Question about how to use an existing octave function in a cc code


From: John W. Eaton
Subject: Question about how to use an existing octave function in a cc code
Date: Thu, 5 Feb 2004 22:09:42 -0600

On  5-Feb-2004, Wen-shiang Chen <address@hidden> wrote:

| Sorry to ask such a newbie question!  I have very limited knowledge about
| c++ programming and just start to learn how to program under octave.
| 
| My question is how to use existing octave functions, in this case, the
| randn function, in my cc code?  The m-file looks like the following,
| x=y+randn(2,10);
| and my incomplete cc code looks like the follwing,
| DEFUN_DLD (mycc, args, ,)
| {
|   Matrix x (2,10);
|   Matrix y (2,10);
| 
|   x=y+??
| }
| 
| So could someone shed some light for me on how to write
|  x=y+randn(2,10);
| in my cc code?  Thanks!

If you are using a recent version of Octave, then rand is available in
liboctave.

For the more general case of calling a function defined in a .m file
or a .oct file, you should use one of the feval functions, which are
declared in parse.h and defined in parse.y.

jwe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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