how can i deleted unused data

3 次查看(过去 30 天)
Zhenwei Sun
Zhenwei Sun 2018-8-24
I’m copy a part sub-module from another project, and implement in my new project. I also copy all the data/signal define to base workspace to avoid any mistakes. But after success built my new project, how can I remove all the data/signals which not used in my project. Or only save the data/signals which used in my project.

回答(1 个)

Adam Danz
Adam Danz 2018-8-24
Don't delete the data. Data storage is cheap these days so just keep it. If you're talking about removing the data from your mat files, that's another story.
Option 1 is to only import the data you need in the first place. It's much more efficient to import only the needed data rather than importing all of the data and then removing what's not needed.
Option 2, if you've already got your mat files and you have the need to clean them up or reduce file size, assuming the data you want to remove is stored somewhere else for future reference, here's how to remove selected variables:
Assuming your mat file is loaded into the workspace, remove variables "var1" and "var2" like this:
clear('var1', 'var2');
Then save your mat file, overwriting the existing file.
If you're trying to remove variables from a mat file that isn't loaded into the workspace, see this (I've never used). https://www.mathworks.com/matlabcentral/answers/254048-how-can-i-delete-variables-in-my-mat-file-without-loading-them-into-matlab-7-2-r2006a#comment_472754
  1 个评论
Zhenwei Sun
Zhenwei Sun 2018-9-3
thx for your inf. yes, currently I used pre-save and pre-load command to save/load the base workspace data to a .mat file. I will try on your examples.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by