24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 228  |  回复: 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 的主题更新
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 305求调剂 +7 RuiFairyrui 2026-03-28 7/350 2026-03-29 00:40 by 544594351
[考研] 一志愿郑州大学,080500学硕,总分317分求调剂 +5 举个栗子oi 2026-03-24 6/300 2026-03-28 23:03 by lizhi8172
[考研] 332求调剂 +4 @MZB382400 2026-03-28 4/200 2026-03-28 21:02 by 唐沐儿
[考研] 071000生物学求调剂,初试成绩343 +7 小小甜面团 2026-03-25 7/350 2026-03-28 20:25 by 唐沐儿
[考研] 一志愿北化085600材料专硕275|有文章专利|求调剂 +7 Micky11223 2026-03-25 7/350 2026-03-28 18:34 by 无际的草原
[考研] 一志愿北京工业大学,324分求调剂 +4 零八# 2026-03-28 4/200 2026-03-28 15:01 by 17865157980
[考研] 304求调剂 +6 曼殊2266 2026-03-27 6/300 2026-03-28 14:10 by 唐沐儿
[考研] 0856求调剂 +11 zhn03 2026-03-25 12/600 2026-03-28 13:32 by 唐沐儿
[考研] 070300求调剂306分 +4 26要上岸 2026-03-27 4/200 2026-03-28 13:06 by 唐沐儿
[考研] 286求调剂 +12 PolarBear11 2026-03-26 12/600 2026-03-28 12:14 by zllcz
[考研] 085602 307分 求调剂 +7 不知道叫什么! 2026-03-26 7/350 2026-03-28 09:57 by 神马都不懂
[考研] 352分 化工与材料 +5 海纳百川Ly 2026-03-27 5/250 2026-03-28 03:39 by fmesaito
[考研] 086000调剂 +3 7901117076 2026-03-26 3/150 2026-03-27 21:34 by Jianing_Mi
[考研] 308求调剂 +7 墨墨漠 2026-03-25 7/350 2026-03-27 14:47 by 狂炫麦当当
[考研] 08开头275求调剂 +4 拉谁不重要 2026-03-26 4/200 2026-03-27 14:12 by Delta2012
[考研] 考研调剂 +10 呼呼?~+123456 2026-03-24 10/500 2026-03-27 11:46 by wangjy2002
[考研] 314求调剂 +3 溪云珂 2026-03-26 3/150 2026-03-27 11:20 by sanrepian
[考研] 081200-11408-276学硕求调剂 +3 崔wj 2026-03-26 3/150 2026-03-26 19:57 by nihaoar
[考研] 303求调剂 +6 蓝山月 2026-03-25 6/300 2026-03-25 22:47 by 418490947
[考研] 336化工调剂 +4 王大坦1 2026-03-23 5/250 2026-03-23 18:32 by allen-yin
信息提示
请填处理意见