【问题标题】:How can I get the handle of a Simulink block in Matlab R2013b?如何在 Matlab R2013b 中获取 Simulink 模块的句柄?
【发布时间】:2018-06-28 20:26:15
【问题描述】:

Matlab R2018b 中有一个函数,getSimulinkBlockHandle,但在 R2013b 中不存在。我想知道如何在没有此功能的情况下获取 Simulink 模块的句柄。我需要它来使用函数get(h,'parameters')

【问题讨论】:

    标签: matlab simulink


    【解决方案1】:

    只需将get_paramset_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

    【讨论】:

    • 感谢 Edric 的回答,但我在 get_param 中搜索了“颜色”作为参数,但实际上我没有找到,我想更改块 Simulink 中文本的颜色
    猜你喜欢
    • 1970-01-01
    • 2013-12-02
    • 2011-04-25
    • 2015-01-30
    • 2011-09-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-28
    相关资源
    最近更新 更多