从MATLAB保存Mat文件 [英] Save mat file from MATLAB
本文介绍了从MATLAB保存Mat文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将变量保存在具有不同图像名称的循环中,例如
I want to save variables in a loop with different image names, like
for i = 1:length(imagefile)
name = imagefile{i};
var = rand(100); % Just for example
save name var
end
它将var
另存为name
,但是如何使用名称值(例如Canon101
)保存它?
It will save var
as name
, but how do I save it with a value of name, for example Canon101
?
推荐答案
Sayyad,您不必使用eval
.您可以简单地使用save
的函数形式,即save(filename,variables)
.这将使用filename
的值.请记住,变量需要以字符串形式输入.因此,在您的示例中,应该是
Sayyad, you don't have to use eval
. You can simply use the function form of save
, i.e., save(filename,variables)
. This will use the value of filename
. Remember that the variables need to be entered as strings. So, in your example, it would be
save(name,'var')
这篇关于从MATLAB保存Mat文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文