Returning status of operation using mex

2 次查看(过去 30 天)
Jw
Jw 2011-12-16
After i call to the mex function i written to do fopen, fred and fclose, how do i return the status to my mat file to check whether the file has been read or opened?

回答(1 个)

Chirag Gupta
Chirag Gupta 2011-12-16
mex functions can return outputs:
void mexFunction(int nlhs, mxArray *plhs[], int nrhs,
const mxArray *prhs[]);
The nlhs : number of left hand arguments and plhs are the arguments you wish to return.
So you could return the status of the MAT file in plhs. You would call this function in MATLAB:
status = NameOfYourMexFunction(inputs);

类别

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