matlab下载数据到workspace出现报错:Warning: Variable '***' not found.

  load('test.mat','y'),当时用的这个命令,最初的想法是把test.mat的数据load到y中。然后就出现了报错:Warning: Variable 'y' not found

  解决办法:我在command窗口输入doc load,查看load('test.mat','y')表示 Load only variable y from example file handel.mat. If the workspace already contains variable y, the load operation overwrites it with data from the file。即是从test.mat中下载变量y的值到workspace,也就是说y必须得是test.mat的变量才行。

  补充:如果我们想实现最初的想法(把test.mat的数据load到y中),可以用 y = load('test.mat')。此时y是一个结构体,假如要引用test.mat中的变量x_data,只需要用y.x_data就可以引用了。

  再补充:我们注意到(If the workspace already contains variable y, the load operation overwrites it with data from the file).如果要load两个.mat文件,而这两个文件中又相同的变量,后者是要替换到前者的,所以引用的时候,要提前把他重命名(赋值给一个新的变量)。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值