【问题标题】:MATLAB cant find class from Simulink CheckMATLAB 无法从 Simulink Check 中找到类
【发布时间】:2019-08-15 08:50:36
【问题描述】:

MATLAB 找不到工具箱的类 - 我该怎么办?

基本上我想使用工具箱库slmetric的Width类,但是MATLAB找不到该库。如何正确解决该问题?

>> misraWidget.setWidths(slmetric.dashboard.Width.Medium);
Undefined variable "slmetric" or class "slmetric.dashboard.Width.Medium".

或者

>> getWidths(misraWidget)
Error using slmetric.dashboard.CustomWidget/getWidths
The class 'slmetric.dashboard.Width' contains a parse error, cannot be found on MATLAB's
search path, or is shadowed by another file with the same name.

我尝试使用“which”来更好地理解正在发生的事情并比较 Group 的结果,这意味着存在 slmetric.* 和 Width 的结果:

>> which slmetric.dashboard.Group
slmetric.dashboard.Group is a built-in method  % slmetric.dashboard.Group constructor
>> which slmetric.dashboard.Width
'slmetric.dashboard.Width' not found.
>> which slmetric.dashboard.Width.Medium
'slmetric.dashboard.Width.Medium' not found.

我正在尝试关注 this tutorial on how to customize your metrics dashboard 的工具箱 Simulink Check。我以Simulink Bounce Demo 为例。如果有人可以向我解释如何在 MATLAB 中解决这样的问题,我将不胜感激。 MATLAB 中的“构建/链接”被隐藏起来了,所以我真的不明白如何处理这些事情。我通过搜索找到的最好的东西是“which”命令。

【问题讨论】:

    标签: matlab simulink


    【解决方案1】:

    我设法解决了我的问题。要回答我的一般性问题,如何了解有关该软件包的更多信息:

    我使用了 ? 而不是 'which'命令来探索我在包中知道的类的元数据。从那个类中,我提取了包的元数据,找到了包的所有类,选择了合适的类,找到了类的所有方法的列表,还找到了合适的类。这不是真正的用户友好,但它确实有效。

    meta_group = ?slmetric.dashboard.Group
    meta_package = meta_group.ContainingPackage
    
    meta_classes = meta_package.ClassList
    for i=1:7
        disp(meta_classes(i).Name)
    end
    
    meta_widget = meta_classes(5)
    widget_methods = meta_widget.MethodList
    for i=1:38
        disp(widget_methods(i).Name)
    end
    

    对于我的具体问题:我改用 setWidthInt,它不依赖于使用 Width 枚举,我仍然没有找到。我在

    中查找了枚举
    meta_classes.EnumerationMemberList
    

    但这对于包中的所有类都是空的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-19
      • 1970-01-01
      • 2017-07-30
      • 2014-07-26
      • 2013-03-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多