putting all my outputs into a vector using print

1 次查看(过去 30 天)
here is my code:
n = 0;
x = input('input an x value ')
while n~=7
n = n+1;
if rem(x,2)==0
fx = (x)/2
x=fx;
elseif rem(x,2)~=0
px = (3*(x))+1
x=px;
end
end
for x=3 i need my output to look like this
3,10,5,16,8,4,2,1 I have the outputs right i just need them in a vector using print

回答(1 个)

Walter Roberson
Walter Roberson 2012-3-4

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by