Search code examples
matlabdependenciesmatlab-deploymentmatlab-app-designer

How to Determine Toolbox dependency for App designer in MATLAB 2017b


I have a project that is a single main app in app designer that i am using as a shell to call 3 matlab scripts and 7 app designer apps. I want to determine Toolbox dependency on the entire project, however the MATLAB documentation shows how to run dependency analysis on simulink models. I have used dependencies.toolboxDependencyAnalysis function on my matlab script files and app files but it only returns {'MATLAB'} . So is there a way to run toolbox dependency analysis in matlab for app designer ?


Solution

  • 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