【发布时间】:2018-06-28 20:26:15
【问题描述】:
Matlab R2018b 中有一个函数,getSimulinkBlockHandle,但在 R2013b 中不存在。我想知道如何在没有此功能的情况下获取 Simulink 模块的句柄。我需要它来使用函数get(h,'parameters')。
【问题讨论】:
Matlab R2018b 中有一个函数,getSimulinkBlockHandle,但在 R2013b 中不存在。我想知道如何在没有此功能的情况下获取 Simulink 模块的句柄。我需要它来使用函数get(h,'parameters')。
【问题讨论】:
只需将get_param 和set_param 与块名称一起使用,而不是块句柄。
编辑
从 cmets 看来,OP 希望处理 Simulink 注释,而不是普通块。这稍微复杂一些,因为注解没有块名。这是一个例子
% Open the "vdp" model
open_system('vdp');
% Find annotations
annotations = find_system(gcs,'FindAll','on','Type','annotation');
% Set the background colour to green for the first of these
set_param(annotations(1), 'BackgroundColor', 'green')
更多:https://uk.mathworks.com/help/simulink/ug/create-an-annotation-programmatically.html
【讨论】: