1

我有一个项目,它是应用程序设计器中的一个主要应用程序,我将其用作外壳来调用 3 个 matlab 脚本和 7 个应用程序设计器应用程序。我想确定 Toolbox 对整个项目的依赖关系,但是 MATLAB 文档显示了如何对 simulink 模型运行依赖关系分析。我在我的 matlab 脚本文件和应用程序文件上使用了 dependencies.toolboxDependencyAnalysis 函数,但它只返回 {'MATLAB'} 。那么有没有办法在matlab中为应用程序设计器运行工具箱依赖分析?

4

1 回答 1

0

You can use the MATLAB function matlab.codetools.requiredFilesAndProducts to show all of the function dependencies and required toolboxes. For example, if you have two functions in separate files:

function a = testdep1(b)
    fprintf(1,'function testdep1\n');
    a(1) = b*2;
    a(2) = testdep2(a(1));
end

and

function c = testdep2(d)
    fprintf(1,'function testdep2\n');
    c = d/3;
end

then you can use:

[fList, pList] = matlab.codetools.requiredFilesAndProducts('testdep1')

to see the list of "program files" required (note this does not include sub-functions in the same file) and the toolboxes required.

fList =

  1×2 cell array

    {'/TEST/testdep1.m'}    {'/TEST/testdep2.m'}

pList = 

  struct with fields:

             Name: 'MATLAB'
          Version: '9.5'
    ProductNumber: 1
          Certain: 1
于 2020-03-14T02:51:53.807 回答