フィルターのクリア

Use S-Function parameters from dialog box

2 ビュー (過去 30 日間)
Vit Valek
Vit Valek 2018 年 7 月 13 日
Hi,
I have created S-Functions with mdlCheckParameters method. I can insert into dialog box numbers in range (0;Inf). How can I configure mdlCheckParameters to inserting negative and decimal numbers into dialog box?
Here is mdlCheckParameters code:
#define MDL_CHECK_PARAMETERS
#if defined(MDL_CHECK_PARAMETERS) && defined(MATLAB_MEX_FILE)
/* Function: mdlCheckParameters =============================================
* Abstract:
* Validate that the parameter is a positive finite integer scalar
*/
static void mdlCheckParameters(SimStruct *S)
{
int ival;
bool badParam = false;
/* All parameters must be positive non-zero integers */
const mxArray *m = ssGetSFcnParam(S,0);
if (mxGetNumberOfElements(m) != 1 ||
!mxIsNumeric(m) || !mxIsDouble(m) || mxIsLogical(m) ||
mxIsComplex(m) || mxIsSparse(m) || !mxIsFinite(mxGetPr(m)[0])) {
badParam = true;
} else if (((ival=(int_T)mxGetPr(m)[0]) <= 0) ||
(real_T)ival != mxGetPr(m)[0]) {
badParam = true;
}
if (badParam) {
ssSetErrorStatus(S,"The parameter must be a positive non-zero "
"integer value.");
return;
}
}
#endif /* MDL_CHECK_PARAMETERS */
Thanks!
Vit

回答 (0 件)

カテゴリ

Help Center および File ExchangeBlock and Blockset Authoring についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by