Mercurial > hg > octave-nkf
annotate examples/globaldemo.cc @ 14101:ff5588774680 stable ss-3-5-91
snapshot 3.5.91
* configure.ac (AC_INIT): Version is now 3.5.91.
(OCTAVE_RELEASE_DATE): Now 2011-12-23.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 23 Dec 2011 19:24:41 -0500 |
parents | 4295d634797d |
children | be41c30bcb44 |
rev | line source |
---|---|
6572 | 1 #include <octave/oct.h> |
2 | |
3 DEFUN_DLD (globaldemo, args, , "Global demo.") | |
4 { | |
5 int nargin = args.length (); | |
6 octave_value retval; | |
7 | |
8 if (nargin != 1) | |
9 print_usage (); | |
10 else | |
11 { | |
12 std::string s = args(0).string_value (); | |
13 if (! error_state) | |
14 { | |
15 octave_value tmp = get_global_value (s, true); | |
16 if (tmp.is_defined ()) | |
17 retval = tmp; | |
18 else | |
19 retval = "Global variable not found"; | |
20 | |
21 set_global_value ("a", 42.0); | |
22 } | |
23 } | |
24 return retval; | |
25 } |