24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 227  |  回复: 1
当前主题已经存档。

fspdlh

金虫 (正式写手)

[交流] 【求助】load函数出错

我把一个程序中经常调用的一些数据存在mat文件中,如果哪个函数要用就load这个文件,一般没问题,但这次出现了如下的错误提示,没看明白
??? Either eval, evalin, assignin, an assignment in a script, load, or an
assignment at the debugger prompt has attempted to dynamically add the
variable "status" to the workspace of one of:
   o  an anonymous function,
   o  a nested function, or
   o  a function that has a nested function.

If you are in the debugger and need a variable, say X, for temporary use
while debugging, make it a global:

   K>> global X; X = ...

One way to avoid this error in the other cases is to pre-declare the variable
in the desired function.  Specific suggestions to eliminate the error:
   o  eval, evalin, assignin --- for many reasons, it is best to avoid using
      these altogether.
   o  assignment in a script --- a script can be turned into a function, with
      argument- and result-passing often clarifying the code.
   o  load --- use the form of load that returns a struct result.

Dynamic addition of variables to workspaces associated with nested functions
is not allowed because the scoping rules for nested functions rely on the
presence or absence of variables in the text of the code.  Permitting the
addition of variables at run-time would make the scoping rules more difficult
to explain and programs harder to understand.  Similarly, dynamic addition of
variables to the workspace of an anonymous function is not allowed.

[ Last edited by sunxiao on 2009-3-21 at 09:53 ]
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

fspdlh

金虫 (正式写手)


sunxiao(金币+1,VIP+0):希望能详细说明,欢迎常来交流 3-21 09:42
呵呵,看明白了,用load函数加载mat文件中的变量,则加载的变量的变量名不能是某个函数的函数名

[ Last edited by fspdlh on 2009-3-21 at 16:28 ]
2楼2009-03-20 18:30:44
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 fspdlh 的主题更新
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 300求调剂,材料科学英一数二 +8 leaflight 2026-03-24 8/400 2026-03-29 01:31 by fmesaito
[硕博家园] 招收生物学/细胞生物学调剂 +4 IceGuo 2026-03-26 5/250 2026-03-29 01:25 by griffith2014
[考研] 332求调剂 +6 蕉蕉123 2026-03-28 6/300 2026-03-29 00:37 by 544594351
[考研] 学硕274求调剂 +9 Li李鱼 2026-03-26 9/450 2026-03-28 21:42 by bymhappy
[考研] 0703一志愿9,初试成绩:338,四六级已过,有科研经历,求调剂! +4 Zuhui0306 2026-03-25 4/200 2026-03-28 13:07 by 唐沐儿
[考研] 求调剂 +8 张zz111 2026-03-27 9/450 2026-03-28 03:41 by fmesaito
[考研] 085600,材料与化工321分,求调剂 +9 大馋小子 2026-03-27 9/450 2026-03-27 14:30 by mmm just
[考研] 314求调剂 +3 溪云珂 2026-03-26 3/150 2026-03-27 11:20 by sanrepian
[考研] 调剂 +3 李嘉图·S·路 2026-03-27 3/150 2026-03-27 11:19 by wangjy2002
[考研] 求调剂 一志愿 本科 北科大 化学 343 +6 13831862839 2026-03-24 7/350 2026-03-26 22:57 by 不吃魚的貓
[考研] 321求调剂 +6 wasdssaa 2026-03-26 6/300 2026-03-26 20:57 by sanrepian
[考研] 材料考研求调剂 +3 Dendel 2026-03-23 6/300 2026-03-26 17:51 by fmesaito
[考研] 环境专硕324分求调剂推荐 +5 轩小宁—— 2026-03-26 5/250 2026-03-26 12:05 by i_cooler
[考研] 一志愿上海交大生物与医药专硕324分,求调剂 +6 jiajunX 2026-03-22 6/300 2026-03-25 23:05 by licg0208
[考研] 一志愿吉林大学材料与化工303分求调剂 +4 为学666 2026-03-24 4/200 2026-03-25 11:27 by BruceLiu320
[考研] 318求调剂 +3 plum李子 2026-03-23 3/150 2026-03-25 09:42 by 雾散后相遇lc
[考研] B区考研调剂 +4 yqdszhdap- 2026-03-22 5/250 2026-03-25 08:51 by baoball
[有机交流] 有机合成求助 20+3 FENGSHUJEI 2026-03-23 5/250 2026-03-24 19:31 by 88817753
[考研] 344求调剂 +3 desto 2026-03-24 3/150 2026-03-24 10:09 by 搏击518
[考研] 石河子大学(211、双一流)硕博研究生长期招生公告 +3 李子目 2026-03-22 3/150 2026-03-22 21:01 by 怎么释怀
信息提示
请填处理意见