Deleting within .mat file
91 次查看(过去 30 天)
显示 更早的评论
Hello,
This is a screenshot of my MAT-file. How do you permantly delete certain structures? For example, if I want 'B' deleted.
I used to be able to right click on the one I wanted to delete, and it gave me options to delete, duplicate, move, etc, but one day it stopped letting me do that. Does anyone know why it no longer lets me delete right in that window? Is there something I need to enable?
Thanks!
0 个评论
采纳的回答
Matt J
2020-8-15
编辑:Matt J
2020-8-15
I don't remember that ever being possible through the Matlab GUI, but attached is a MEX file that can do it.
rmvarMatfileMEX('allData.mat','B')
10 个评论
Matt J
2020-8-17
Well, you need to show the full script in order for us say what's really going on. It sounds unrelated, though, to the issue in your post.
更多回答(2 个)
Walter Roberson
2020-8-15
A work-around that is sometimes good enough is to create the variable locally with empty contents, and save with the -append flag. The old variable in the file will be marked as unused and the new empty variable will be saved in the file.
This does not completely remove the variable from the file: the variable name would still be there, just associated with empty content. But the previous content would no longer be associated with the name.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!