[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Exporting a variable to the global workspace from a C++ function
From: |
Justin Bare |
Subject: |
Re: Exporting a variable to the global workspace from a C++ function |
Date: |
Wed, 12 Aug 2009 08:59:30 -0400 (EDT) |
User-agent: |
SquirrelMail/1.4.8-4.fc5 |
I tried the function you gave me in this way inside a C++ function:
string c = "x";
const string& cref = c;
octave_value x = 9;
const octave_value& xref = x;
cout << cref << endl;
cout << xref.int_value() << endl;
set_global_value(cref, xref);
cout << get_global_value("x").int_value() << endl;
Which prints out this in Octave:
x
9
9
But what I want to do is create the variable x in this C++ function and
send it to the global workspace so that when I type "x" in the octave
command line it will give me "x = 9" instead of "error: `x' undefined near
line 39 column 1"
Is there a way to do this?
Thanks.
Justin
--
Justin Bare
Robotic Research, LLC.
814 West Diamond Ave, Suite 301
Gaithersburg, MD 20878
240-631-0008 Ext 246
> On 11-Aug-2009, Justin Bare wrote:
>
> | I am writing a function in C++ that will be called from Octave (using
> the
> | information found at
> | http://octave.sourceforge.net/doxygen/html/annotated.html). I want the
> | function to create a variable inside the function and export it to the
> | global workspace so that it can be used as a normal variable in the
> global
> | workspace. Is there a kind of export function in the C++/Octave
> interface
> | to do this?
> | Thanks for the help.
>
> Look at the set_global_value function declared in variables.h.
>
> jwe
>
--
Justin Bare
Robotic Research, LLC.
814 West Diamond Ave, Suite 301
Gaithersburg, MD 20878
240-631-0008 Ext 246
- Exporting a variable to the global workspace from a C++ function, Justin Bare, 2009/08/11
- using save command, dastew, 2009/08/12
- Re: using save command, James Sherman Jr., 2009/08/12
- RE: using save command, dastew, 2009/08/12
- RE: using save command, dastew, 2009/08/13
- RE: using save command, macy, 2009/08/13
- RE: using save command, dastew, 2009/08/13