-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathhelperDrivingProjectSetup.m
52 lines (42 loc) · 1.74 KB
/
helperDrivingProjectSetup.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function helperDrivingProjectSetup(projectArchivedName, nvp)
% 从目录
% This is a wrapper function around projectDemoSetUp that helps in
% extracting all the required projects (main and reference) from the zip
% files by using the name of the main project's zip file name to a working
% directory. "workDir" can be used to specify a working directory. The
% project should be in toolbox/driving/drivingdemos directory.
%
% projectArchivedName: The zip file name of the main project.
% Example 1:
% helperDrivingProjectSetup('FVSFTestBench.zip');
% Example 2:
% helperDrivingProjectSetup("FVSFTestBench.zip", "workDir","C:\Users\home\MATLAB\work");
%
% Note: If the project is already opened, 'helperDrivingProjectSetup' will
% not fetch the new files again.
%
% This is a helper function and may be changed or removed without notice.
% Copyright 2020-2021 The MathWorks, Inc.
arguments
projectArchivedName;
nvp.workDir char = '';
end
% Get current root project info
proj = matlab.project.rootProject;
% Get project name from "projectArchivedName" excluding .zip extension
[~,projectName,~] = fileparts(projectArchivedName);
% Extract and open the project if it is not already opened.
if(isempty(proj) || proj.Name ~= projectName)
% Extract the main and reference projects using projectDemoSetUp
% [projectFolderPath,~] = matlab.internal.project.example.projectDemoSetUp(fullfile(matlabroot,'toolbox','driving','drivingdemos',projectArchivedName),nvp.workDir,'');
% change the path to project folder path.
projectFolderPath = projectName;
cd(projectFolderPath);
% open project.
openProject(projectName);
% change the directory path to the "workDir".
if(~isempty(nvp.workDir))
cd(nvp.workDir);
end
end
end