What is an alternative for round(A, N) in version R2014a.

7 vues (au cours des 30 derniers jours)
Ondrej Panek
Ondrej Panek le 9 Nov 2016
Commenté : Jan le 10 Nov 2016
I am using a function round(A, N) in my code in version R2015b. But sometimes I need to use the same code in version R2014a for some reasons. But this lower version does not accept this function and I can not find any alternative. Is there any alternative in the version R2014a?
  1 commentaire
Jan
Jan le 10 Nov 2016
@Ondrej: If you take the time to search for "round" in this forum, you will find the posted solution fast. This is more efficient than asking again.

Connectez-vous pour commenter.

Réponse acceptée

Star Strider
Star Strider le 9 Nov 2016
I created this one for that purpose:
roundn = @(x,n) round(x .* 10.^n)./10.^n; % Round ‘x’ To ‘n’ Digits, Emulates Latest ‘round’ Function
It works the same way, and gives the same results as the built-in function.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing 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