User`s guide

25 Create Model Advisor Checks
25-42
return
end
regularFontSize = str2double(regularFontSize);
if regularFontSize<1 || regularFontSize>=99
mdladvObj.setCheckResultStatus(false);
ResultDescription{end+1} = ModelAdvisor.Paragraph(['Invalid font size. '...
'Please enter a value between 1 and 99']);
ResultDetails{end+1} = {};
end
% find all blocks inside current system
allBlks = find_system(system);
% block diagram doesn't have font property
% get blocks inside current system that have font property
allBlks = setdiff(allBlks, {system});
% find regular font name blocks
regularBlks = find_system(allBlks,'FontName',regularFontName);
% look for different font blocks in the system
searchResult = setdiff(allBlks, regularBlks);
if ~isempty(searchResult)
ResultDescription{end+1} = ModelAdvisor.Paragraph(['It is recommended to '...
'use same font for blocks for a uniform appearance in the model. '...
'The following blocks use a font other than ' regularFontName ': ']);
ResultDetails{end+1} = searchResult;
mdladvObj.setCheckResultStatus(false);
myLVParam = ModelAdvisor.ListViewParameter;
myLVParam.Name = 'Invalid font blocks'; % pull down filter name
myLVParam.Data = get_param(searchResult,'object')';
myLVParam.Attributes = {'FontName'}; % name is default property
mdladvObj.setListViewParameters({myLVParam});
needEnableAction = true;
else
ResultDescription{end+1} = ModelAdvisor.Paragraph(['All block font names '...
'are identical.']);
ResultDetails{end+1} = {};
end
% find regular font size blocks
regularBlks = find_system(allBlks,'FontSize',regularFontSize);
% look for different font size blocks in the system
searchResult = setdiff(allBlks, regularBlks);
if ~isempty(searchResult)
ResultDescription{end+1} = ModelAdvisor.Paragraph(['It is recommended to '...
'use same font size for blocks for a uniform appearance in the model. '...
'The following blocks use a font size other than ' ...
num2str(regularFontSize) ': ']);
ResultDetails{end+1} = searchResult;
mdladvObj.setCheckResultStatus(false);
myLVParam = ModelAdvisor.ListViewParameter;
myLVParam.Name = 'Invalid font size blocks'; % pull down filter name
myLVParam.Data = get_param(searchResult,'object')';
myLVParam.Attributes = {'FontSize'}; % name is default property