Mercurial > octave-dspies
annotate examples/mystruct.c @ 18710:584b20e9112c gui-release
use shortcut manager for the main help menu
* main_window.cc (add_action): new parameter for the signal receiver;
(construct_help_menu): use add_action for the actions of the menu;
(construct_documentation_menu): use add_action for the actions of the menu;
(set_global_shortcuts): set/unset shortcuts
* main-window.h: actions are class variables, add_action with new parameter
* shortcut-manager.cc (do_init_data): initialize the shortcuts in the help menu
author | Torsten <ttl@justmail.de> |
---|---|
date | Thu, 01 May 2014 12:12:08 +0200 |
parents | 224e76250443 |
children |
rev | line source |
---|---|
5864 | 1 #include "mex.h" |
2 | |
3 void | |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
9932
diff
changeset
|
4 mexFunction (int nlhs, mxArray* plhs[], |
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
9932
diff
changeset
|
5 int nrhs, const mxArray* prhs[]) |
5864 | 6 { |
6686 | 7 int i; |
8 mwIndex j; | |
5864 | 9 mxArray *v; |
10 const char *keys[] = { "this", "that" }; | |
11 | |
12 if (nrhs != 1 || ! mxIsStruct (prhs[0])) | |
13 mexErrMsgTxt ("expects struct"); | |
14 | |
15 for (i = 0; i < mxGetNumberOfFields (prhs[0]); i++) | |
6581 | 16 for (j = 0; j < mxGetNumberOfElements (prhs[0]); j++) |
5864 | 17 { |
17791
224e76250443
Use GNU style coding conventions for code in examples/
Rik <rik@octave.org>
parents:
16867
diff
changeset
|
18 mexPrintf ("field %s(%d) = ", mxGetFieldNameByNumber (prhs[0], i), j); |
6580 | 19 v = mxGetFieldByNumber (prhs[0], j, i); |
16867
be41c30bcb44
Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents:
9932
diff
changeset
|
20 mexCallMATLAB (0, NULL, 1, &v, "disp"); |
5864 | 21 } |
22 | |
23 v = mxCreateStructMatrix (2, 2, 2, keys); | |
24 | |
25 mxSetFieldByNumber (v, 0, 0, mxCreateString ("this1")); | |
26 mxSetFieldByNumber (v, 0, 1, mxCreateString ("that1")); | |
27 mxSetFieldByNumber (v, 1, 0, mxCreateString ("this2")); | |
28 mxSetFieldByNumber (v, 1, 1, mxCreateString ("that2")); | |
29 mxSetFieldByNumber (v, 2, 0, mxCreateString ("this3")); | |
30 mxSetFieldByNumber (v, 2, 1, mxCreateString ("that3")); | |
31 mxSetFieldByNumber (v, 3, 0, mxCreateString ("this4")); | |
32 mxSetFieldByNumber (v, 3, 1, mxCreateString ("that4")); | |
33 | |
34 if (nlhs) | |
35 plhs[0] = v; | |
36 } |