Is there a good way to eliminate clutter after a build in SLRT?

3 views (last 30 days)
I'd like to automatically eliminate clutter left around after a build in SLRT. For example, the slprj folder, the various .m files (...bio.m, etc.), and the hdl_prj folder. I know some of this is left behind to facilitate faster future builds, but I'd like to have the option for these files and folders to go away after a build. Is there a setting or option that would facilitate that?

Answers (1)

Nithin Kumar
Nithin Kumar on 7 Sep 2023
Hi James,
I understand that you want to automatically eliminate some of the folders after a build in SLRT.
In Simulink Real-Time (SLRT), there is no built-in option to automatically remove all the generated files and folders after a build. These files are typically left behind to speed up future builds and to maintain a record of the generated code.
I recommend you create a post-build script that runs after the build process is complete. This script should contain commands to remove the files and folders you want to delete.
Kindly refer to the following steps to create a post-build script:
1. Create a new MATLAB script file, e.g., "cleanup_after_build.m".
2. In the script, use MATLAB commands to delete the files and folders you want to remove as shown in the following code snippet -
% Delete the slprj folder
if exist('slprj', 'dir')
rmdir('slprj', 's');
end
% Delete all .m files in the current directory
delete('*.m');
% Delete the hdl_prj folder
if exist('hdl_prj', 'dir')
rmdir('hdl_prj', 's');
end
% Add more delete commands if required
3. Save the script.
4. In your Simulink Real-Time project, go to the build settings.
5. Specify the path to your "cleanup_after_build.m" script as the post-build script.
6. Save your project settings.
Now, when you build your project, the post-build script will automatically execute after the build process is completed, and it will delete the specified files and folders.
I hope this provides you with the required information regarding your query.
Regards,
Nithin Kumar.

Tags

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!