integer parameters to C MEX s function

조회 수: 9 (최근 30일)
fengming
fengming 2012년 4월 19일
function mxGetPr(ssGetSFcnParam(S,0)) can get REAL parameter from the mask of simulink block. is there any function can get integer paramter from simulink block mask, or how to convert a real number to integer in C MEX s function.
Thanks a lot.
Fengming

채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 4월 19일
I think you need to use mxGetData(ssGetSFcnParam(S,0)) instead and cast the returned void-pointer to an int pointer. You probably want to throw an error if ssGetDTypeIdFromMxArray(ssGetSFcnParam(S,0))!=SS_INT32 (or SS_INT8, SS_UINT8, SS_INT16, SS_UINT16, SS_UINT32 depending on what type you're expecting).
mxGetPr must only be used if the parameter is a double value.
  댓글 수: 2
fengming
fengming 2012년 4월 20일
Thank you. is there any help documents or manual including the function list? i mean, if i want some functions, how could i find it?
Kaustubha Govind
Kaustubha Govind 2012년 4월 20일
Yes, see http://www.mathworks.com/help/releases/R2011b/toolbox/simulink/sfg/f9-5492.html for SimStruct-specific functions, and http://www.mathworks.com/help/releases/R2011b/techdoc/apiref/bqoqnz0.html#bqoqobe-1 for mxArray related functions.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by