i need help please

i'm trying to write a code to solve a problem and the only problem i have is when i try to display the answers in a table it displays as rows not coloumns
here is my code
if true
% clc
clear
input('Welcome to the Advanced IPR calculator software press enter to continue ')
Pr=input('Please enter the average reservoir pressure in units of psig ');
Pwf=input('please enter the wellbore pressure in psig ');
q=input('please input the flow rate ');
j=(q/(Pr-Pwf));
fprintf('j is equal to %2.4f \n',j)
a=input('to calculate the flow rate at a diffrent value for pressure press 1 to skip this part press 2 ')
if a==1
Pwf1=input('please enter the wellbore pressure that you want in psig ');
q1=j*(Pr-Pwf1);
fprintf('the value of the flow rate at %2.4f psig is %2.4f \n',Pwf1,q1)
else
end
input('to calculate Qmax press enter')
Qmax=(q/(1-(0.2*(Pwf/Pr))-(0.8*(Pwf/Pr)^2)));
fprintf('The maximum flow rate that can be applied is %2.4f \n',Qmax)
input('to draw the rlation between Q and Pwf press enter ');
d=input('please enter the minimum value of the pressure ');
e=input('please enter the maximum value of the pressure ');
g=input('please enter the step size');
PWF=d:g:e;
n=length(PWF);
for i=1:n
Qv(i)=(1067*((1-(0.2*(PWF(i)/Pr))-(0.8*(PWF(i)/Pr)^2))));
end
f=figure;
cnames={'PWF','q'};
t=uitable('Data',[PWF;Qv],'ColumnName',cnames);
figure
plot(Qv,PWF,'r:')
title('IPR')
grid on
grid minor
xlabel('q');
ylabel('PWF');code
end

Respuestas (1)

Geoff Hayes
Geoff Hayes el 13 de Mzo. de 2017

1 voto

Ahmed - just transpose your data in the table as
t=uitable('Data',[PWF;Qv]','ColumnName',names);
Note the apostrophe [PWF;Qv]' which will transpose the data (matrix).

Categorías

Más información sobre Mathematics and Optimization en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 13 de Mzo. de 2017

Comentada:

el 13 de Mzo. de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by