Possible Duplicate:
Default Arguments in Matlab
I have two functions in Matlab, test1 and test2, as shown below.
function [C,D] = test1(A,B)
A = 50;
B = 20;
C = A + B;
D = A - B;
end
and
function test2
C = 1000;
D = 500;
[A,B] = test1(C,D);
display(A)
display(B)
end
Now what I would like to do is have set default values for A and B in function test1 but also be able to pass into function test1 different values from another function like function test2. So by default have A and B set to 50 and 20 in function test1, but with function test2 be able to replace them with 1000 and 500, and obtain the equivalent C and D result (in the case of 1000 and 500, get a result of 1500 and 500 for C and D respectively)
How can I do this? Any help would be greatly appreciated. Thanks