Create a simple while-loop.

8 visualizaciones (últimos 30 días)
Petrus
Petrus el 24 de Abr. de 2014
Respondida: Andrew Newell el 24 de Abr. de 2014
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!

Respuestas (1)

Andrew Newell
Andrew Newell el 24 de Abr. de 2014
If your goal is to find the next integer above 1.5^t, you could do it using
ceil(1.5^t)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by