24小时热门版块排行榜    

Znn3bq.jpeg
查看: 242  |  回复: 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 的主题更新
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 面上本子正文33页,违规吗?会被低分嘛? +8 1234567wang 2026-05-17 10/500 2026-05-18 18:52 by zzahkj
[硕博家园] 考博自荐 +5 科研狗111 2026-05-13 6/300 2026-05-18 11:22 by 糊糊涂涂好
[找工作] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +4 ky2p12rrjj 2026-05-15 4/200 2026-05-17 19:47 by Equinoxhua
[公派出国] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +4 v9tggjlwd0 2026-05-15 5/250 2026-05-17 18:39 by Equinoxhua
[考博] 2026博士还有哪些学校有名额 +6 小王求读研 2026-05-15 7/350 2026-05-17 16:54 by 知音湖畔
[考博] 光量子物理方向 博士招生 1人(2026.09) +3 sandyworld 2026-05-15 4/200 2026-05-17 14:38 by sandyworld
[考研] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +4 v9tggjlwd0 2026-05-15 4/200 2026-05-17 08:11 by 11n4dfd8yn
[找工作] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +3 l7k6xnh0yc 2026-05-14 6/300 2026-05-17 07:31 by 11n4dfd8yn
[考博] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +6 l7k6xnh0yc 2026-05-14 6/300 2026-05-17 07:11 by 11n4dfd8yn
[硕博家园] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +5 cjf4bx70cj 2026-05-14 7/350 2026-05-17 06:55 by 11n4dfd8yn
[博后之家] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +4 k37jurhrau 2026-05-16 4/200 2026-05-17 01:35 by ue3ir18jc3
[考研] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +3 k37jurhrau 2026-05-16 3/150 2026-05-17 01:25 by ue3ir18jc3
[公派出国] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +3 x0mp7owy2b 2026-05-15 4/200 2026-05-17 00:35 by ue3ir18jc3
[基金申请] 请问大佬b0816评完了吗 +4 市民华南虎 2026-05-12 8/400 2026-05-16 19:54 by Equinoxhua
[有机交流] 如何实现卤原子转化 +3 BT20230424 2026-05-15 5/250 2026-05-16 16:20 by czyzsu
[硕博家园] 售SCI一区T0P文章,我:8.O.5.5.1.O.5.4,科目齐全,可+急 +3 k37jurhrau 2026-05-16 3/150 2026-05-16 13:57 by vcdazktkjx
[硕博家园] 申请博士 +3 呃?呃 2026-05-15 3/150 2026-05-16 11:01 by a4742549
[教师之家] 教学课件你会给同学吗 +8 硕士研究生吗 2026-05-13 8/400 2026-05-14 22:23 by 常规沥青
[考博] 26应届毕业生考博求助 +3 wo一定上岸 2026-05-13 3/150 2026-05-14 21:47 by 明海天涯
[考博] 材料类只有一篇综述能申博么 +4 乐逍遥谷 2026-05-13 4/200 2026-05-14 12:05 by zhyzzh
信息提示
请填处理意见