MATLAB: How to suppress answer in Matlab

MATLABsuppress

Hi, I'm trying to calculate e^x for some value of x using the taylor expansion approximation
T_n(x) = Sum (x^k/k!)
And I have managed to do this using the following m-file
function T = findexp(x,n) %findexp, function to evaluate e^x T(1)=1; for i = 2:n+1 T(i) = T(i-1)+x^(i-1)/(factorial(i-1)); if i == n+1 fprintf(1,'T(%d) = %1.15e\n',x,T(i)); end end
However, when I then type findexp(1,25) for example the output is
T(1) = 2.718281828459046e+000
ans =
Columns 1 through 8
1.0000 2.0000 2.5000 2.6667 2.7083 2.7167 2.7181 2.7183
Columns 9 through 16
2.7183 2.7183 2.7183 2.7183 2.7183 2.7183 2.7183 2.7183
Columns 17 through 24
2.7183 2.7183 2.7183 2.7183 2.7183 2.7183 2.7183 2.7183
Columns 25 through 26
2.7183 2.7183
How do I suppress the columns and just show the T(1) part.
Sorry I realise this is a really amateurish question I just have done very little Matlab programming before.
Thanks in advance

Best Answer

Just don't define output in the function definition line, or when you call the function, add semicolon at the end, i.e.,
findexp(1,25);