필터 지우기
필터 지우기

Zero inputs in C-Mex-function

조회 수: 2 (최근 30일)
Priyanka
Priyanka 2013년 8월 20일
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

채택된 답변

James Tursa
James Tursa 2013년 8월 20일
// 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);
}
}

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by