本文介绍了加载部分matfile错误:"VARName"不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在matfile中加载数组的一部分,如中所示http://www.mathworks.com/help/matlab/ref/matfile.html

i'm trying to load part of array in a matfile like is showed in http://www.mathworks.com/help/matlab/ref/matfile.html

但是,当我使用loadedData = matObj.varName(indices)时,我不断得到:'varName'不存在

however, when i use loadedData = matObj.varName(indices) i keep getting: 'varName' does not exist

有人知道怎么了吗?

推荐答案

您应该使用要检索的实际变量的名称代替 VarName .

In place of VarName you should use the name of the actual variable you want to retrieve.

假设您已将变量A保存到myMat:

Suppose you have saved a variable A into myMat:

A      = rand(10);
save('myMat','A','-v7.3')

matObj = matfile('myMat');
data   = matObj.A(1:2,2);

这篇关于加载部分matfile错误:"VARName"不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-07 20:03