annotate examples/code/celldemo.cc @ 20412:b7ee5cefa9d6 stable

Update make_int example to current octave_base_value API (bug #45136) * make_int.cc (octave_integer::print): Make non-const. Add a newline for consistency with core library conventions.
author Mike Miller <mtmiller@octave.org>
date Mon, 18 May 2015 19:14:41 -0400
parents c8240a60dd01
children 2f8500ca91d3
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;
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
7 int nargin = args.length ();
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
8
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
9 if (nargin != 1)
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
10 print_usage ();
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
11 else
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
12 {
16867
be41c30bcb44 Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents: 12174
diff changeset
13 Cell c = args(0).cell_value ();
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
14 if (! error_state)
16867
be41c30bcb44 Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents: 12174
diff changeset
15 for (octave_idx_type i = 0; i < c.numel (); i++)
be41c30bcb44 Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents: 12174
diff changeset
16 {
be41c30bcb44 Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents: 12174
diff changeset
17 retval(i) = c(i); // using operator syntax
be41c30bcb44 Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents: 12174
diff changeset
18 //retval(i) = c.elem (i); // using method syntax
be41c30bcb44 Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents: 12174
diff changeset
19 }
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
20 }
9053
4295d634797d remove copyright notices from example files
John W. Eaton <jwe@octave.org>
parents: 7081
diff changeset
21
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
22 return retval;
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
23 }