Mercurial > hg > octave-lyh
annotate examples/celldemo.cc @ 16867:be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
* doc/interpreter/dynamic.txi: deleted.
* doc/interpreter/external.txi: Renamed from dynamic.txi. Rewrote or added
much information about dynamically linked functions.
* doc/interpreter/Makefile.am: Changed dynamic.txi to external.txi
in build system.
* doc/interpreter/data.txi, doc/interpreter/intro.txi,
doc/interpreter/octave.texi, doc/interpreter/sparse.txi: Changed dynamic.txi to
external.txi in cross-references.
* doc/interpreter/doccheck/aspell-octave.en.pws: Added new words from
external.txi to Octave dictionary.
* examples/firstmexdemo.c: deleted.
* examples/mex_demo.c: Renamed from firstmexdemo.c. Added many more comments
to code.
* examples/hello.cc: deleted.
* examples/oct_demo.cc: Renamed from hello.cc. Added many more comments
to code.
* examples/Makefile.am: Changed build system to use mex_demo.c and oct_demo.cc.
* examples/addtwomatrices.cc, examples/celldemo.cc, examples/embedded.cc,
examples/fortdemo.cc, examples/funcdemo.cc, examples/globaldemo.cc,
examples/helloworld.cc, examples/mycell.c, examples/myfeval.c,
examples/myfunc.c, examples/myhello.c, examples/mypow2.c, examples/myprop.c,
examples/myset.c, examples/mysparse.c, examples/mystring.c,
examples/mystruct.c, examples/paramdemo.cc, examples/standalone.cc,
examples/stringdemo.cc, examples/structdemo.cc, examples/unwinddemo.cc:
Use Octave coding conventions for code. Fixed all compilation errors and
warnings.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 29 Jun 2013 18:08:24 -0700 |
parents | db1f49eaba6b |
children |
rev | line source |
---|---|
6572 | 1 #include <octave/oct.h> |
2 #include <octave/Cell.h> | |
3 | |
12174 | 4 DEFUN_DLD (celldemo, args, , "Cell Demo") |
6572 | 5 { |
6 octave_value_list retval; | |
7 int nargin = args.length (); | |
8 | |
9 if (nargin != 1) | |
10 print_usage (); | |
11 else | |
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 | 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 | 20 } |
9053
4295d634797d
remove copyright notices from example files
John W. Eaton <jwe@octave.org>
parents:
7081
diff
changeset
|
21 |
6572 | 22 return retval; |
23 } |