MATLAB: Function file not working correctly

function fileMATLAB

Hello, I am trying to get my function file to only show the information i need, however it shows an additional number that i know is from the first equation (x).
I only want the x,y,z variables to show on the command window.
My function file:
function [x,y,z] = func(rint,rext,g,e)
x=(2*(pi)*(rint)*500)+(2*(pi)*(rext)*500);
fprintf('x %0.1f\n',x);
V=(pi)*(((rext)^2)-((rint)^2))*500;
y=0.0015*V;
fprintf('y %0.1f\n',y);
z=(g*y*e)-(y)-(2000);
fprintf('z %0.1f\n',z);
end
My script file:
clear all
clc
rint=2.5;
rext=2.8;
e=5;
g=500;
disp(func(rint,rext,g,e));
----------------------------
My Command window:
x 16650.4
y 3.7
z 7362.1 1.6650e+04
I don't know what the last number is and i would like to know why it pops up so i can remove it.

Best Answer

Your code contains fprintf() statements, but you also disp() the result of the function call. The first output of your function is x, so after your function is run, x will be disp()'d. The 1.6650e+04 is the disp() of your x value of 16650.4