24小时热门版块排行榜    

查看: 276  |  回复: 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 的主题更新
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[硕博家园] 售一区SCI文章T0P,我:8O.551.O54,科目全,可十急 +3 YLHlRHNwYkce 2026-09-02 7/350 2026-09-03 17:02 by T0rGB46095mJ
[硕博家园] 售SCI一区文章,我:8.O.551.O.5.4,科目全,可伽急 +3 rFEsUBKXRll0 2026-09-02 6/300 2026-09-03 16:49 by T0rGB46095mJ
[考研] 售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急 +3 ero8OE6tv9cu 2026-09-02 10/500 2026-09-03 16:27 by T0rGB46095mJ
[教师之家] 售SCI一区T0P文章,我:8.O55.1.O.54,科目全,可十急 +3 ero8OE6tv9cu 2026-09-02 8/400 2026-09-03 14:48 by T0rGB46095mJ
[基金申请] 国社科又开始会评了,不知道这次命运如何 +10 雨打竹帘 2026-08-30 14/700 2026-09-03 13:17 by qsd10086
[教师之家] 售SCI一区文章,我:8.O.55.1.O.54,科目齐全,可伽急 +3 YLHlRHNwYkce 2026-09-02 8/400 2026-09-03 12:03 by T0rGB46095mJ
[基金申请] 麻烦专家们看看评委们的意见(F口面上) +8 gdd2018 2026-08-28 13/650 2026-09-03 06:22 by 羽毛枫f
[公派出国] 售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急 +3 ero8OE6tv9cu 2026-09-02 4/200 2026-09-03 03:14 by rM1TE0WVDIIY
[基金申请] 要骂人了,新模版改版就是要淡化问题凝练这种虚的东西,结果有个评委还在说凝练得不够 +9 瞬息宇宙 2026-08-31 17/850 2026-09-02 14:04 by anjeeshine
[基金申请] 基金系统什么内容也没有 30+4 winsaint 2026-08-27 10/500 2026-09-02 11:35 by 大不刘6
[基金申请] 学科评审组评审是指会评吗? +5 瞬息宇宙 2026-08-31 5/250 2026-09-02 10:13 by 雨冰共舞
[基金申请] 面上函评意见出来了,像什么等级? 20+4 Tsingking1 2026-08-27 17/850 2026-09-01 19:51 by 超级无敌华子
[论文投稿] 小白求助 投论文要求的highlights应该如何写 5+3 l1963982152 2026-08-29 4/200 2026-09-01 09:04 by 北京莱茵编辑
[基金申请] 面上意见出来了 +12 黄鸟于飞Chao 2026-08-29 23/1150 2026-08-31 18:57 by 黄鸟于飞Chao
[基金申请] 能否申诉? +7 echo8914667 2026-08-30 8/400 2026-08-31 17:00 by yihongxu
[基金申请] 中青基了要发朋友圈吗? +7 349506619 2026-08-28 7/350 2026-08-31 13:39 by 冼亮淀粉酶
[基金申请] 29号明天会评吗 +4 笨笨唐 2026-08-28 4/200 2026-08-31 09:30 by huixian257
[考博] 找导师 +6 yuanjiabao 2026-08-29 7/350 2026-08-30 14:40 by 生科新手
[基金申请] 我就是申请一个面上项目而已,这评审意见是按照杰青的条件评的吧? +6 gouxfjh 2026-08-28 11/550 2026-08-30 07:57 by gouxfjh
[基金申请] 国自然评审意见 +13 wangmingqi 2026-08-28 19/950 2026-08-29 10:22 by Poppy1104
信息提示
请填处理意见