Mercurial > octave-dspies
view examples/mex_demo.c @ 18963:a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
* graphics.in.h (base_graphics_object, graphics_object, root): add new method "get_factory_defaults_list" to retrieve factory defaults as property_list
* graphics.in.h (base_graphics_object::reset_default_properties (void)): move definition to graphics.cc
* graphics.cc (xreset_default_properties): new function to set a list of prop/val
* graphics.cc (base_graphics_object::reset_default_properties): use xreset_default_properties, override with parents' defaults
* graphics.cc (root_figure::reset_default_properties, figure::reset_default_properties, uitoolbar::reset_default_properties): same as above but first empty local defaults
* graphics.cc (axes_figure::reset_default_properties): same as above but use "propeties.set_defaults" to reset properties to their factory value.
* graphics.cc (axes_figure::properties::set_defaults): new "reset" mode, that does the same as "replace" but x/y/zlabels and title are reset instead of being deleting/recreating.
* graphics.cc: add %!tests for Freset
author | pantxo <pantxo.diribarne@gmail.com> |
---|---|
date | Fri, 21 Mar 2014 11:05:28 +0100 |
parents | 877b82d73ed9 |
children |
line wrap: on
line source
// mex_demo.c -- example of a dynamically linked function for Octave. // To use this file, your version of Octave must support dynamic // linking. To find out if it does, type the command // // octave_config_info ("ENABLE_DYNAMIC_LINKING") // // at the Octave prompt. Support for dynamic linking is included if // this expression returns the string "yes". // // To compile this file, type the command // // mkoctfile --mex mex_demo.c // // from within Octave or from the shell prompt. This will create a file // called mex_demo.mex that can be loaded by Octave. To test the mex_demo.mex // file, start Octave and type the command // // d = mex_demo ("easy as", 1, 2, 3) // // at the Octave prompt. Octave should respond by printing // // Hello, world! // I have 4 inputs and 1 output // d = 1.2346 // Additional samples of code are in the examples directory of the Octave // distribution. See also the chapter External Code Interface in the // documentation. #include "mex.h" // Every user function should include "mex.h" which imports the basic set of // function prototypes necessary for dynamically linked functions. In // particular, it will declare mexFunction which is used by every function // which will be visible to Octave. A mexFunction is visible in Octave under // the name of the source code file without the extension. // The four arguments to mexFunction are: // 1) The number of return arguments (# of left-hand side args). // 2) An array of pointers to return arguments. // 3) The number of input arguments (# of right-hand side args). // 4) An array of pointers to input arguments. void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { mexPrintf ("Hello, World!\n"); mexPrintf ("I have %d inputs and %d outputs\n", nrhs, nlhs); mxArray *v = mxCreateDoubleMatrix (1, 1, mxREAL); double *data = mxGetPr (v); *data = 1.23456789; plhs[0] = v; }