如何清除Mat文件的变量? [英] How to clear variables of a mat file?

查看:289
本文介绍了如何清除Mat文件的变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为save.mat的mat文件,其中有两个变量.我想清除变量并添加其他一些变量.如何清除/添加Mat文件中的变量?

I have a mat file, named save.mat, which has two variables. I want to clear the variables and add some other variables. How could I clear/add variables inside a mat file?

最佳

推荐答案

@excaza提出了很好的建议.要验证matfile命令是否按照建议的方式工作,请尝试以下操作:

@excaza has made a good recommendation, I think. To verify that the matfile command works as suggested, try the following:

filename = ('file.mat');
m = matfile(filename,'Writable',true);

y = 23;
m.y = y;
clear y
load(filename);
display(y);

y = 24;
m.y = y;
clear y
load(filename);
display(y);

这篇关于如何清除Mat文件的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆