Matlab 有一种 with...end 命令吗? http://msdn.microsoft.com/en-us/library/wc500chb(v=vs.80).aspx
我的工作区中有一个变量,其中包含大量嵌套数据。现在我不想一直输入这个:
Root.ChildLevel1.A = Root.ChildLevel1.B + Root.ChildLevel1.C
而是像这样的东西:
with Root.ChildLevel1
A = B + C
end
这可能吗?
最佳答案
我不知道 Matlab 中有这样的功能。
你能做的是
cur = Root.ChildLevel1;
cur.A = cur.B + cur.C;
编辑:
根据@Nick 的评论,如果 Root.ChildLevel1
not subclass of handle
,
然后应该添加以下行:
Root.ChildLevel1 = cur;
我也推荐
clear cur;
最后。
关于Matlab - With ... 结束结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14754898/