Create a simple while-loop.
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi! I would like to create a simple while-loop for this problem:
input t = 'Pick a number'
i = 1:300
K = 1.5^t - 1*i
while K>0 continue,
while K<0 stop and disp 'i'.
end
How do I do this script in MatLab? Thanks!
댓글 수: 0
답변 (1개)
Andrew Newell
2014년 4월 24일
If your goal is to find the next integer above 1.5^t, you could do it using
ceil(1.5^t)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!