How to get missing files programmatically similar to GUI Dependency Analysis?
조회 수: 9 (최근 30일)
이전 댓글 표시
In Analyze Project Dependencies - MATLAB & Simulink - MathWorks Nordic we read it is possible to do an dependency analysis to find cases where a file cannot be found. Find model file dependencies - MATLAB dependencies.fileDependencyAnalysis - MathWorks Nordic suggests this can be done programmatically for a Simulink model.
For Matlab projects the suggested feature to use is Get files required by specified project files - MATLAB listRequiredFiles - MathWorks Nordic, but this cannot produce a list of missing files same as the others. Clicking in the GUI for Dependency Analysis on the project produces such lists just fine, suggesting something manages to pull it off. Exacyl how eludes me.
Is there a way to get a missing files list programmatically for files in a Matlab Project?
댓글 수: 0
답변 (1개)
Poorna
2024년 4월 4일
Hi Andreas,
I see that you would like to get the missing files in a MATLAB project programmatically like "dependencies.fileDependencyAnalysis" for simulink models.
Although I am not sure of any readymade function to get all the missing files but I do have a workaround. Starting from MATLAB R2024a, the "findFiles" function is available. You can use this function to list all the files of the project. When you specify the "OutputFormat" as "ProjectFile" the output of the "findFiles" function will now be an array of type "ProjectFile". The "ProjectFile" object has a property called "SourceControlStatus". For all the missing files this property will be set to "Missing".
Therefore, you can filter the project files list based on the "SourceControlStatus" property to get the list of missing files as below:
files = findFiles(proj, "OutputFormat", "ProjectFile");
missingFileIndices = [files.SourceControlStatus] == 'Missing';
missingFiles = files(missingFileIndices);
To know more about the "findFiles" function refer to the following documentation:
Hope this Helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Dependency Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!