MATLAB: How to store function output as a matrix

for loopmatrixoutputstore output

Hi! I need help storing the output of P as a matrix so it would look like:
T P
0 corresponding value from P eqn
10 corresponding value from P eqn
20 corresponding value from P eqn
etc.
I am not the best with matlab, but any help would be appreciated. When I run the code, it becomes split apart. Thanks!
out = [];
for T = [0:10:100]
Volume = [0.0735560; 0.0736893; 0.0738233; 0.0739572; 0.0740910; 0.0742250; 0.0743592; 0.0744936; 0.0746282; 0.0747631; 0.0748981];
V0 = Volume(1,1); % index



V100 = Volume(11,1); % index
Temp = [0;10;20;30;40;50;60;70;80;90;100];
T0 = Temp(1,1); % index
T100 = Temp(11,1); % index
P = V0 + (((T - T0)*(V100 - V0))/(T100 - T0)); % simple equation
out = [T P]
end

Best Answer

out = zeros([],2);
count = 0 ;
for T = [0:10:100]
Volume = [0.0735560; 0.0736893; 0.0738233; 0.0739572; 0.0740910; 0.0742250; 0.0743592; 0.0744936; 0.0746282; 0.0747631; 0.0748981];
V0 = Volume(1,1); % index







V100 = Volume(11,1); % index
Temp = [0;10;20;30;40;50;60;70;80;90;100];
T0 = Temp(1,1); % index
T100 = Temp(11,1); % index
P = V0 + (((T - T0)*(V100 - V0))/(T100 - T0)); % simple equation

count = count+1 ;
out(count,:) = [T P]
end
OR
T = [0:10:100] ;
N = length(T) ;
out = zeros(1,N);
for i = 1:N
Volume = [0.0735560; 0.0736893; 0.0738233; 0.0739572; 0.0740910; 0.0742250; 0.0743592; 0.0744936; 0.0746282; 0.0747631; 0.0748981];
V0 = Volume(1,1); % index
V100 = Volume(11,1); % index
Temp = [0;10;20;30;40;50;60;70;80;90;100];
T0 = Temp(1,1); % index
T100 = Temp(11,1); % index
P = V0 + (((T(i) - T0)*(V100 - V0))/(T100 - T0)); % simple equation
count = count+1 ;
out(i) = P ;
end
[T' out']