[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to share variables between functions
From: |
Evan |
Subject: |
Re: How to share variables between functions |
Date: |
Wed, 4 Apr 2007 21:42:09 +0800 |
Thanks for the answer
and by the way, I made a careless mistake in the example
On 4/3/07, Evan <address@hidden> wrote:
In some cases, it seems that sharing variables between functions
cannot be avoidable. for example
function y=f(x)
global x;
y=quad(subf,0,1);
clear x;
endfunction
This function should be
function y=f(x)
global xx;
xx=x;
y=quad(subf,0,1)
clear xx;
endfunction
function f=subf(t)
global x;
f=g(x,t);
and here should be
global xx;
f=g(xx,t);
endfunction
function y=g(x,t)
......
endfunction