User`s guide
25 Create Model Advisor Checks
25-62
ResultStatus = false;
end
ResultDescription{end+1} = ft2; % Pass list template object to Model Advisor
mdladvObj.setCheckResultStatus(ResultStatus); % Set overall check status
% Enable Modify Settings button when check fails
mdladvObj.setActionEnable(~ResultStatus);
Action Callback Function
The following is an example of an action callback function that fixes the optimization
settings that the Model Advisor reviews as defined in “Check With Subchecks and
Actions” on page 25-60.
% Sample Check 3 Action Callback Function: Check with Subresults and Actions
% Fix optimization settings
function result = modifyOptmizationSetting(taskobj)
% Initialize variables
result = ModelAdvisor.Paragraph();
mdladvObj = taskobj.MAObj;
system = bdroot(mdladvObj.System);
% 'Block reduction' is selected
% Clear the check box and display text describing the change
if ~strcmp(get_param(system,'BlockReduction'),'off')
set_param(system,'BlockReduction','off');
result.addItem(ModelAdvisor.Text( ...
'Cleared the ''Block reduction'' check box.',{'Pass'}));
result.addItem(ModelAdvisor.LineBreak);
end
% 'Conditional input branch execution' is selected
% Clear the check box and display text describing the change
if ~strcmp(get_param(system,'ConditionallyExecuteInputs'),'off')
set_param(system,'ConditionallyExecuteInputs','off');
result.addItem(ModelAdvisor.Text( ...
'Cleared the ''Conditional input branch execution'' check box.', ...
{'Pass'}));
end
For an example of an action callback function that updates all of the blocks in the model
with the font specified in the Input Parameter defined in “Input Parameter Definition”
on page 25-53, review the customization source code in slvnvdemo_mdladv.