Rounding to next integer

10 vues (au cours des 30 derniers jours)
Nicholas Salce
Nicholas Salce le 12 Oct 2016
Commenté : Nicholas Salce le 12 Oct 2016
I am trying to create a program to calculate a module size for solar panels. The answers can only be a whole integer value. I tried using round() to do this but in a case where the decimal value is below 0.5 it will round down. I would like it to round all values to the next whole integer. For instance if the calculation gives an answer of 2.1 I want output value to be 3.

Réponse acceptée

Steven Lord
Steven Lord le 12 Oct 2016
See the ceil function.
  1 commentaire
Nicholas Salce
Nicholas Salce le 12 Oct 2016
Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by