小技巧
在函数中用persistent定义变量。
例子:
function re=test() persistent a; if isempty(a) a=1; end a=a+1; re=a; end
小技巧
在函数中用persistent定义变量。
例子:
function re=test() persistent a; if isempty(a) a=1; end a=a+1; re=a; end
转载于:https://www.cnblogs.com/tiandsp/archive/2013/04/09/3010240.html