Zero inputs in C-Mex-function

Hello
Is it possible to have zero inputs in C-Mex-function. If so can anyone give me an example of having zero inputs and more than 1 output in the mex-function.
Thank you
Priyanka

 Réponse acceptée

James Tursa
James Tursa le 20 Août 2013

0 votes

// 0 inputs, any reasonable number of outputs (scalars 1, 2, ... etc)
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
int i;
for( i=0; i<nlhs; i++ ) {
plhs[i] = mxCreateDoubleScalar(i+1);
}
}

Plus de réponses (0)

Catégories

En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Centre d'aide et File Exchange

Produits

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by