Mercurial > octave-nkf
annotate examples/code/celldemo.cc @ 20654:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | 2f8500ca91d3 |
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; | |
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 | 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 | 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 | 17 } |
9053
4295d634797d
remove copyright notices from example files
John W. Eaton <jwe@octave.org>
parents:
7081
diff
changeset
|
18 |
6572 | 19 return retval; |
20 } |