view examples/firstmexdemo.c @ 14136:20cb178716ee

Make nargin and nargout behave more like Matlab's (Bug #32700) * ov-usr-fcn.cc: Include "ov-fcn-handle.h". (Fnargout, Fnargin) nargout can be given a function handle as well as a string. Allow nargout(fcn) works in the top level. Make inline functions always return 1. Make anonymous functions always return -1. Make functions with varargout optionally preceded by named outputs return -(length_output_list_including_the_varargout).
author Iain Murray <iain@iainmurray.net>
date Mon, 02 Jan 2012 12:49:52 -0500
parents 6cb30a539481
children
line wrap: on
line source

#include "mex.h"

void
mexFunction (int nlhs, mxArray *plhs[], int nrhs, 
             const mxArray *prhs[])
{
  mxArray *v = mxCreateDoubleMatrix (1, 1, mxREAL);
  double *data = mxGetPr (v);
  *data = 1.23456789;
  plhs[0] = v;
}