annotate examples/code/celldemo.cc @ 20578:2f8500ca91d3

eliminate error_state from example files * addtwomatrices.cc, celldemo.cc, embedded.cc, fortrandemo.cc, funcdemo.cc, globaldemo.cc, helloworld.cc, make_int.cc, paramdemo.cc, stringdemo.cc, structdemo.cc, unwinddemo.cc: Eliminate use of global error_state variable.
author John W. Eaton <jwe@octave.org>
date Sat, 03 Oct 2015 16:05:27 -0400
parents c8240a60dd01
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
1 #include <octave/oct.h>
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
2 #include <octave/Cell.h>
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
3
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 9053
diff changeset
4 DEFUN_DLD (celldemo, args, , "Cell Demo")
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
5 {
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
6 octave_value_list retval;
20578
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
7
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
8 if (args.length () != 1)
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
9 print_usage ();
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
10
20578
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
11 Cell c = args(0).cell_value ();
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
12
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
13 for (octave_idx_type i = 0; i < c.numel (); i++)
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
14 {
20578
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
15 retval(i) = c(i); // using operator syntax
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
16 //retval(i) = c.elem (i); // using method syntax
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
17 }
9053
4295d634797d remove copyright notices from example files
John W. Eaton <jwe@octave.org>
parents: 7081
diff changeset
18
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
19 return retval;
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
20 }