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
댓글 수: 0
답변 (1개)
Walter Roberson
2012년 3월 4일
See the mechanisms used in (for example) http://www.mathworks.com/matlabcentral/answers/31053-returning-and-plotting-values-from-while-loop-results
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!