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.

 Risposta accettata

TAB
TAB il 29 Ago 2018
Just like Inputs and Outputs there are S-function APIs to access the parameters.
Please check

5 Commenti

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 il 30 Ago 2018
Modificato: TAB il 30 Ago 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!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Simulink Coder in Centro assistenza e File Exchange

Prodotti

Release

R2017b

Richiesto:

il 29 Ago 2018

Commentato:

il 14 Nov 2018

Community Treasure Hunt

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

Start Hunting!

Translated by