Filter löschen
Filter löschen

Zero inputs in C-Mex-function

1 Ansicht (letzte 30 Tage)
Priyanka
Priyanka am 20 Aug. 2013
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

Akzeptierte Antwort

James Tursa
James Tursa am 20 Aug. 2013
// 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);
}
}

Weitere Antworten (0)

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by