Script to create/load a project
7 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I want to write a script to automatically create/load a project in matlab and add relevant folders/files to the project. The following script should be doing it.
clear all;
fullPath = which("loadProj.m");
thisFilePath = "loadProj.m";
project_root = strrep(fullPath, thisFilePath,"");
% Load cuSim project if already the project already exists
projExist = isfile(fullfile(project_root,"\myProj.prj"));
if (projExist)
openProject(project_root);
else
proj = matlab.project.createProject(project_root);
proj.Name = 'MySim';
% Add project root itself
addFolderIncludingChildFiles(MySim, fullfile(project_root,'file1'));
addFolderIncludingChildFiles(MySim, fullfile(project_root,'file2'));
addFolderIncludingChildFiles(MySim, fullfile(project_root,'file3'));
addFolderIncludingChildFiles(MySim, fullfile(project_root,'file4'));
end
However, i get the following error when trying to run the above script multiple times. I have manually deleted the myProj.prj file from the project root but still it gives the following error.
Error using matlab.project.createProject
The specified folder already contains a project.
Error in matlab.project.createProject
Error in matlab.project.createProject
Error in loadSimProj (line 35)
proj = matlab.project.createProject(project_root);
5 件のコメント
Mario Malic
2020 年 9 月 20 日
編集済み: Mario Malic
2020 年 9 月 20 日
Then, accept my answer to your question. Thanks in advance.
回答 (1 件)
Mario Malic
2020 年 9 月 19 日
You need to delete .prj file and resources folder with it as well.
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!