필터 지우기
필터 지우기

MEX-equivalent of INPUTNAME

조회 수: 2 (최근 30일)
Bård Skaflestad
Bård Skaflestad 2011년 11월 10일
All,
Is there a way, within a mexFunction, of retrieving the actual name of (the caller's) argument passed as one of the prhs parameters? Or, in other words, is there a way in MEX to do the equivalent of the inputname function as in
function f(a)
fprintf('Formal parameter ''a'' is called ''%s''\n', ...
inputname(1))
end

채택된 답변

Kaustubha Govind
Kaustubha Govind 2011년 11월 10일
I don't think there is a MEX-API function that is the equivalent, but you can always use mexCallMATLAB to dispatch the call to MATLAB itself.
  댓글 수: 7
Kaustubha Govind
Kaustubha Govind 2011년 11월 11일
This solution has an attached example where a function handle is passed into a MEX-function, which is then evaluated using mexCallMATLAB and feval: http://www.mathworks.com/support/solutions/en/data/1-9RKXIN/index.html - I believe this is what Jan is suggesting.
Bård Skaflestad
Bård Skaflestad 2011년 11월 11일
I suppose so, too. I've tried it now and it works perfectly. Thank you so much, both of you. This was really helpful.

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

추가 답변 (1개)

Jan
Jan 2011년 11월 10일
You can use mexCallMATLAB to call FEVAL with the function handle as argument.
Perhaps somebody knows how to use mxFevalFunctionHandle?
  댓글 수: 1
Bård Skaflestad
Bård Skaflestad 2011년 11월 11일
Thank you, Jan. This is the solution I ended up using.

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

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by