Mercurial > hg > octave-max
view examples/mystruct.c @ 14324:5a2b012b10c7
allow zooming for logscale plots
* graphics.cc (axes::properties::zoom_about_point): Allow zooming for
logscale axes.
* graphics.h.in (class neg_log_scaler): New class.
(log_scalar::do_neg_scale): Delete
(log_scalar::scale): Don't attempt to handle negative data.
(axes::properties::get_scale): New function.
(axes::properties::update_xscale, axes::properties::update_yscale,
axes::properties::update_zscale): Use it.
(axes::properties::update_xlim): Call update_xscale.
(axes::properties::update_ylim): Call update_yscale.
(axes::properties::update_zlim): Call update_zscale.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 03 Feb 2012 19:54:26 -0500 |
parents | 6cb30a539481 |
children |
line wrap: on
line source
#include "mex.h" void mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { int i; mwIndex j; mxArray *v; const char *keys[] = { "this", "that" }; if (nrhs != 1 || ! mxIsStruct (prhs[0])) mexErrMsgTxt ("expects struct"); for (i = 0; i < mxGetNumberOfFields (prhs[0]); i++) for (j = 0; j < mxGetNumberOfElements (prhs[0]); j++) { mexPrintf ("field %s(%d) = ", mxGetFieldNameByNumber (prhs[0], i), j); v = mxGetFieldByNumber (prhs[0], j, i); mexCallMATLAB (0, 0, 1, &v, "disp"); } v = mxCreateStructMatrix (2, 2, 2, keys); mxSetFieldByNumber (v, 0, 0, mxCreateString ("this1")); mxSetFieldByNumber (v, 0, 1, mxCreateString ("that1")); mxSetFieldByNumber (v, 1, 0, mxCreateString ("this2")); mxSetFieldByNumber (v, 1, 1, mxCreateString ("that2")); mxSetFieldByNumber (v, 2, 0, mxCreateString ("this3")); mxSetFieldByNumber (v, 2, 1, mxCreateString ("that3")); mxSetFieldByNumber (v, 3, 0, mxCreateString ("this4")); mxSetFieldByNumber (v, 3, 1, mxCreateString ("that4")); if (nlhs) plhs[0] = v; }