view examples/myset.c @ 17160:f2a8592b8fbd

doc: Shorten some long subsection names in Manual. Remove excess spaces from ends of @menu definitions. * doc/interpreter/arith.txi, doc/interpreter/basics.txi, doc/interpreter/bugs.txi, doc/interpreter/container.txi, doc/interpreter/data.txi, doc/interpreter/diagperm.txi, doc/interpreter/diffeq.txi, doc/interpreter/emacs.txi, doc/interpreter/expr.txi, doc/interpreter/external.txi, doc/interpreter/func.txi, doc/interpreter/grammar.txi, doc/interpreter/gui.txi, doc/interpreter/install.txi, doc/interpreter/intro.txi, doc/interpreter/io.txi, doc/interpreter/java.txi, doc/interpreter/linalg.txi, doc/interpreter/matrix.txi, doc/interpreter/nonlin.txi, doc/interpreter/numbers.txi, doc/interpreter/octave.texi, doc/interpreter/optim.txi, doc/interpreter/plot.txi, doc/interpreter/preface.txi, doc/interpreter/quad.txi, doc/interpreter/sparse.txi, doc/interpreter/stats.txi, doc/interpreter/stmt.txi, doc/interpreter/strings.txi, doc/interpreter/system.txi, doc/interpreter/var.txi: Shorten some long subsection names in Manual. Remove excess spaces from ends of @menu definitions.
author Rik <rik@octave.org>
date Fri, 02 Aug 2013 13:52:39 -0700
parents be41c30bcb44
children
line wrap: on
line source

#include "mex.h"

void
mexFunction (int nlhs, mxArray* plhs[],
             int nrhs, const mxArray* prhs[])
{
  char *str;
  mxArray *v;

  if (nrhs != 2 || ! mxIsString (prhs[0]))
    mexErrMsgTxt ("expects symbol name and value");

  str = mxArrayToString (prhs[0]);

  v = mexGetArray (str, "global");

  if (v)
    {
      mexPrintf ("%s is a global variable with the following value:\n", str);
      mexCallMATLAB (0, NULL, 1, &v, "disp");
    }

  v = mexGetArray (str, "caller");

  if (v)
    {
      mexPrintf ("%s is a caller variable with the following value:\n", str);
      mexCallMATLAB (0, NULL, 1, &v, "disp");
    }

  // WARNING!! Can't do this in MATLAB!  Must copy variable first.
  mxSetName (prhs[1], str);  
  mexPutArray (prhs[1], "caller");
}