Use nargin/nargout on generated mex Functions

조회 수: 3 (최근 30일)
Stefan
Stefan 2012년 12월 19일
답변: Mike Hosea 2014년 3월 27일
Hello,
I am currently facing the problem that I would like to apply the nargin/nargout function to a mex function I generated.
Usually one can use them in order get the number of inputs/outputs from outside the function. This works for example as follows:
>>nargin(@sum)
>>nargout(@sum)
When I use these functions on a generated mex function i get the following error:
>> Error using nargout
>> xyz_coder_mex does not know how to answer nargin/nargout.
Does anyone know a workaround or is it generally not possible to access these parameters of a mex function?
Greetings, Stefan
  댓글 수: 1
Stefan
Stefan 2012년 12월 19일
I found a workaround:
One can program a wrapper function, which is calling the mex function
e.q.
-----
function [a,b,c] = xyz_coder_wrapper(d,e,f)
[a,b,c] = xyz_coder_mex(d,e,f)
-----
Thereby one can use its knowledge of the underlying MATLAB/c function

댓글을 달려면 로그인하십시오.

답변 (1개)

Mike Hosea
Mike Hosea 2014년 3월 27일
Not sure why this question slipped through unnoticed. I've created an enhancement request to make nargin and nargout work when given a function handle to a MATLAB Coder generated mex file.

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by