Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

How to install select callback function in STF?

Asked by Prathamesh

Prathamesh (view profile)

on 30 Nov 2012

I was trying to declare model reference compliance in STF. This is what i did to install select callback:

rtwgensettings.Version = '1';

rtwgensettings.SelectCallback = 'custom_select_callback_handler(hDlg, hSrc)';
slConfigUISetVal(hDlg, hSrc, 'ModelReferenceCompliant', 'on');
slConfigUISetEnabled(hDlg, hSrc, 'ModelReferenceCompliant', false);
slConfigUISetVal(hDlg, hSrc, 'ParMdlRefBuildCompliant', 'on');
slConfigUISetEnabled(hDlg, hSrc, 'ParMdlRefBuildCompliant', false);

When I try to load the STF, I get following error:

Warning: The following error occurred processing the System Target File '':

Undefined function or variable 'hDlg'.

What am I missing?

Thanks.

0 Comments

Prathamesh

Prathamesh (view profile)

Products

1 Answer

Answer by Kaustubha Govind

Kaustubha Govind (view profile)

on 30 Nov 2012
Accepted answer

The code:

slConfigUISetVal(hDlg, hSrc, 'ModelReferenceCompliant', 'on');
slConfigUISetEnabled(hDlg, hSrc, 'ModelReferenceCompliant', false);
slConfigUISetVal(hDlg, hSrc, 'ParMdlRefBuildCompliant', 'on');
slConfigUISetEnabled(hDlg, hSrc, 'ParMdlRefBuildCompliant', false);

Should be defined in a separate MATLAB file named custom_select_callback_handler.m that should be present on the MATLAB path:

function custom_select_callback_handler(hDlg, hSrc)
slConfigUISetVal(hDlg, hSrc, 'ModelReferenceCompliant', 'on');
slConfigUISetEnabled(hDlg, hSrc, 'ModelReferenceCompliant', false);
slConfigUISetVal(hDlg, hSrc, 'ParMdlRefBuildCompliant', 'on');
slConfigUISetEnabled(hDlg, hSrc, 'ParMdlRefBuildCompliant', false);

1 Comment

Prathamesh

Prathamesh (view profile)

on 30 Nov 2012

Thanks Kaustubha, that works!

Kaustubha Govind

Kaustubha Govind (view profile)

Contact us