MATLAB: Sending parameters to a function

function

I have a function that looks like this:
function ci = cifun(y,T,TM,TMO,G2,A,b,x,Epsi,ny,Vc,c2,D2,Q)
syms G2;syms T;syms TM;syms TMO;syms ny;syms A;syms Epsi;
syms b;syms x;syms y;syms Vc;syms c2;syms D2;syms Q;syms z;
R = 8.314472;
k = 1.38065E-23;
D = D2.*exp(-Q./(R.*T));
cidel = matlabFunction(cidelfun, 'Vars',{'z' 'T' 'TM' 'TMO' 'G2' 'A' 'b' 'x' 'Epsi' 'ny' 'D2' 'Q' 'R' 'Vc'});
cidelfun2 = @(z) cidel(z,T,TM,TMO,G2,A,b,x,Epsi,ny,D2,Q,R,Vc);
ci = ((Vc.*c2)./D).*exp(-(Wifun./(T.*k))-(Vc.*y./D))*quad(cidelfun2,-250*b,250*b);
end
It needs certain parameters to work and if I write them in the function it works. But the problem is that I'm going to use this function with different parameters different times so I need to send them along when I call the function. I tried to write like this:
T = 1273;
TM = 2163;
TMO = -0.5;
G2 = 126000;
A = 1.2E-29;
b = 0.000000000258;
x = 2/3*b;
Epsi = 0.00487903650119246;
ny = 0.3;
D2 = 0.0000169;
Vc = 1E-9;
c2 = 18.07551;
Q = 263900;
R = 8.314472;
ci = cifun(T,TM,TMO,G2,A,b,x,Epsi,ny,Vc,c2,D2,Q)
But it don't work. So my question is how to do to make it work?

Best Answer

Of course, "But it don't work" is very vague.
Now, even though you don't say what happens, I am guessing that your input variables are immediately overwritten in the function by your declarations. When a value is passed in, you don't then re-declare it inside the function, because then whatever you passed in is lost. For example, if you pass in a value for T of 1273, as you show, the first thing that happens (on the first line!) in your function is that the value you passed in is overwritten and T is declared as a symbolic variable.
Try this simple function as an example. It simply takes a number and doubles it. First try to double any number using the function as I have written it, then try it again with the first line of the function erased. See if you get a different answer!
function B = mydouble(A)
A = rand; % Erase this line after you try to call, say: mydouble(3)
B = 2*A;
%
%
%
EDIT In response to your 'answer' below...
The first error is because you have declared your function to take 14 argument with this line:
function ci = cifun(y,T,TM,TMO,G2,A,b,x,Epsi,ny,Vc,c2,D2,Q)
But then on this line,
ci = cifun(T,TM,TMO,G2,A,b,x,Epsi,ny,Vc,c2,D2,Q)
You only pass in 13. MATLAB doesn't care about the names, just the number and order. When you call your function as above, MATLAB goes through and assigns the first passed argument to the first declared parameter. So it gives the value you passed in as T to the parameter y inside the function. Then it assigns the second passed argument to the second declared parameter. So it gives the value you passed in as TM to the parameter T inside the function... and so on until you see that the value you passed in as Q goes to the parameter D2 inside the function, leaving Q inside the function undefined.
So if your function declaration says it takes N arguments and you only pass N-1, the Nth parameter will be undeclared inside the function. If you try to then use this parameter, you will see the same error you saw.
Since you declare y as syms inside the function, you are back to the first problem you had. That you are overwriting the value as soon as it is passed in. So take the y out of the function declaration line!