Mercurial > octave-nkf
view examples/code/myprop.c @ 20611:40ed9b46a800
new octave_value::string_value method with optional error message
* ov.h (octave_value::string_vector): New method.
ov-base.cc, ov-base.h (octave_base_value::string_vector):
New default method.
ov-str-mat.cc, ov-str-mat.h (octave_char_matrix_str::string_value):
New method.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 08 Oct 2015 16:43:22 -0400 |
parents | 5c42ff6f0eb1 |
children |
line wrap: on
line source
#include "mex.h" void mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { double handle; char property[256]; if (nrhs < 2 || nrhs > 3) mexErrMsgTxt ("incorrect number of arguments"); if (! mxIsDouble (prhs[0])) mexErrMsgTxt ("handle must be a double scalar"); if (! mxIsChar (prhs[1])) mexErrMsgTxt ("property must be a string"); handle = mxGetScalar (prhs[0]); mxGetString (prhs[1], property, 256); plhs[0] = mxDuplicateArray (mexGet (handle, property)); if (nrhs == 3) if (mexSet (handle, property, mxDuplicateArray (prhs[2]))) mexErrMsgTxt ("failed to set property"); }