主要内容

setRecAction

添加“建议的操作”部分和文本

语法

setRecAction(ft_obj,recActionText)

说明

setRecAction(ft_obj,recActionText) 是一个可选方法,用于向报告中添加“建议的操作”部分。可使用此方法来描述如何修复检查发现的问题。

输入参数

ft_obj

模板对象的句柄。

recActionText

由字符向量或格式化对象句柄组成的元胞数组,用于描述修复检查所报告的问题时建议采取的操作。

有效的格式化对象包括:ModelAdvisor.ImageModelAdvisor.LineBreakModelAdvisor.ListModelAdvisor.ParagraphModelAdvisor.TableModelAdvisor.Text

模型顾问会在报告中的列表或表下方,将“建议的操作”显示为一个单独的部分。

示例

创建一个列表对象 ft,在模型中查找 Gain 模块,并建议对这些模块进行更改:

ft = ModelAdvisor.FormatTemplate('ListTemplate');
% Find all Gain blocks
gainBlocks = find_system(gcs, 'BlockType','Gain');

% Find Gain blocks
for idx = 1:length(gainBlocks)
    gainObj = get_param(gainBlocks(idx), 'Object');

    setRecAction(ft, {'If you are using these blocks '...
    'as buffers, you should replace them with '...
    'Signal Conversion blocks'});
end