Simulink联合​PX4硬件在环仿真临​时文件占C盘空间过大​问题,请问如何解决?

16 次查看(过去 30 天)
Shengjian
Shengjian 2025-2-21
回答: Anushka 2025-6-20
When Simulink and PX4 carried out hardware-in-the-loop simulation, the space of the C drive dropped sharply, so how long can these temporary files be stored in which path?

回答(1 个)

Anushka
Anushka 2025-6-20
When performing Hardware-in-the-Loop (HIL) simulation with PX4 in Simulink, temporary files can accumulate on your ‘C’ drive, potentially consuming significant disk space. These temporary files are typically stored in the following paths:
1. They are stored in the 'MATLAB Temporary Directory'. This is usually located at “C:\Users\<YourUsername>\AppData\Local\Temp”. You can check the specific path by using the command “tempdir” in MATLAB.
You can refer to the following documentation of “tempdir” to get a better understanding: https://www.mathworks.com/help/matlab/ref/tempdir.html
2. Simulink may also create cache files in the project directory or in the working directory where your Simulink model is saved.
To manage disk space, you can periodically clear these temporary files. MATLAB does not automatically delete these files, so it's advisable to do this manually or set up a script to clean them up after simulations.
Here’s a sample MATLAB script to delete temporary files:
tempDir = tempdir;
delete(fullfile(tempDir, '*.*')); % Deletes all files in the temp directory
disp('Temporary files deleted from MATLAB temp directory.');
Make sure to run this script when you are certain that no important files are in the temporary directory, as it will delete all files within it.
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by