array did not substitute

6 次查看(过去 30 天)
abdul azim
abdul azim 2022-1-6
回答: Voss 2022-1-6
Substitute the array into the equation
somehow it only solve the final input may i know which part is wrong
count = 0;
x=[]
Set_data=3
while count < Set_data
y = [input('Input initial Pressure ')]
x=[y]
count=count+1;
end
Density=sqrt(y.*9.81)

采纳的回答

Voss
Voss 2022-1-6
y (and x) contains only the most recent input. To keep all inputs, you can do this:
count = 0;
x=[]
Set_data=3
while count < Set_data
y = [input('Input initial Pressure ')]
x(end+1)=y;
count=count+1;
end
Density=sqrt(x.*9.81)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by