-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcleanupSimulinkArtifacts.m
More file actions
50 lines (43 loc) · 1.81 KB
/
cleanupSimulinkArtifacts.m
File metadata and controls
50 lines (43 loc) · 1.81 KB
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
% cleanupSimulinkArtifacts
% この関数は、カレントフォルダ内の以下を削除します。
% 1. slprj フォルダとその配下
% 2. *.slxc ファイル
% 3. *.mex* ファイル
% 最後に Simulink.fileGenControl をリセットして設定を初期状態に戻します。
% 1. slprj フォルダを削除
if isfolder('slprj')
% 's' オプションで再帰的に削除
rmdir('slprj', 's'); % :contentReference[oaicite:0]{index=0}
fprintf('Deleted folder: slprj\n');
end
% 2. .slxc ファイルをすべて削除
slxcFiles = dir('*.slxc');
if ~isempty(slxcFiles)
delete('*.slxc'); % :contentReference[oaicite:1]{index=1}
fprintf('Deleted %d .slxc files\n', numel(slxcFiles));
end
% 3. MEX ファイルをすべて削除 (*.mexw64, *.mexa64 など)
mexFiles = dir('*.mex*');
if ~isempty(mexFiles)
delete('*.mex*'); % :contentReference[oaicite:2]{index=2}
fprintf('Deleted %d MEX files\n', numel(mexFiles));
end
% 4. Simulink.fileGenControl の設定をリセット
% これにより、キャッシュおよびコード生成フォルダ設定を元に戻す
Simulink.fileGenControl('reset'); % :contentReference[oaicite:3]{index=3}
fprintf('Simulink.fileGenControl has been reset\n');
% 5. ready-to-runパッケージによる生成物を削除
delete('TrajectoryFollowVehicle.zip');
delete('TrajectoryFollowVehicle.slprotodata');
delete('TrajectoryFollowVehicle_*');
delete('TrajectoryFollowVehicleWith14DoF.zip');
delete('TrajectoryFollowVehicleWith14DoF.slprotodata');
delete('TrajectoryFollowVehicleWith14DoF_*');
delete('SfCompatibilityCheckData.mat');
delete('TrajectoryFollowVehicleWith14DoF.slprotodata');
rmdir('pkg_*', 's');
rmdir('*_nanoshrlib_rtw*', 's');
% rmdir('codegen*', 's');
rmdir('m2m_*', 's');
rmdir('videos*', 's');
rmdir('par_mdl_ref*', 's');