Azzera filtri
Azzera filtri

Zero inputs in C-Mex-function

1 visualizzazione (ultimi 30 giorni)
Priyanka
Priyanka il 20 Ago 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

Risposta accettata

James Tursa
James Tursa il 20 Ago 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);
}
}

Più risposte (0)

Categorie

Scopri di più su Write C Functions Callable from MATLAB (MEX Files) in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by