matlab练习程序(静态变量) 小技巧 在函数中用persistent定义变量。 例子: function re=test() persistent a; if isempty(a) a=1; end a=a+1; re=a; end