How to read a value of S function popup in C code?

I have masked a S function in which popup menu(ex: CAN1,CAN2,CAN3) is added. i need to get the selected index in C code.

 Accepted Answer

Just like Inputs and Outputs there are S-function APIs to access the parameters.
Please check

5 Comments

Thank you for sharing the API info.
I have seen the S function API's , if i execute below code , unable to get the index of selected popup
seudo code to get index of the selected options(CAN1,CAN2 popup options)
#define CAN_PARM(S) ssGetSFcnParam(S,0)
static void mdlOutputs(SimStruct *S, int_T tid)
{
int_T data;
const mxArray* mx = CAN_PARM(S);
int channel = (int)mxGetScalar(mx);
switch(channel)
{
case 0: data= CAN1; break; //CAN1 and CAN2 are enums
case 1: data= CAN2; break;
}
}
please tell me how to resolve this problem.
Thank you in advance
TAB
TAB on 30 Aug 2018
Edited: TAB on 30 Aug 2018
Have you tried with S-function builder ?
Add your parameters in S-function builder and generate the s-function.
Generated s-function will have correct code to access the parameters. You can use that code as a reference.
I have tried with S-function builder, Added popup Mask parameter for S-function builder and built the S-function. it has created .c and .tlc file but it does not have code of popup Mask parameter.
I have resolved it, Thank you for your suggestion
Hello, Can you tell me the solvement?
Thank you!

Sign in to comment.

More Answers (0)

Products

Release

R2017b

Asked:

on 29 Aug 2018

Commented:

on 14 Nov 2018

Community Treasure Hunt

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

Start Hunting!