![]() |
重写但未重新定义已定义函数的“未定义”错误
这有效(画出“空”图):
function testme plot(1) 这有效(返回1): function testme plot = @(x)x; plot(1) 这不是(错误:“未定义的函数或变量'图'。”): function testme if 0 plot = @(x)x; end plot(1) 这里发生了什么?为什么重写但未重新定义已定义的函数会导致该函数未定义? 注1:这不是内置函数专用的;以下代码返回相同的错误: function testme if 0 myfun = @(x)x; end myfun(1) function x=myfun(x) x=x*2; 注2:错误发生在函数环境中,而不是脚本中;以下代码不返回错误(并且绘制与第一个示例相同的空图): if 0 plot = @(x)x; end plot(1) [url=https://stackoverflow.com/q/59197724]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 23:37。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.