How can we let Matlab to choose the decimal place?
Afficher commentaires plus anciens
Hi there, I would like to ask if like my answer is 1.11111 and my error is 0.001234, so suppose I should write my answer like 1.111+-0.001. So is there any output method so that MATLAB can know that it should display the first non-zero digit for the error and the answer should have the same decimal place as the error?
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 24 Nov 2011
0 votes
No, there is no MATLAB output method that does that. You would have to program one.
Examine the behavior of the floor() and ceil() of log10(error); you will probably find that you need a minimum of 1 "if" condition, perhaps even 2. Watch out for values above or below 1, and watch out for exact powers of 10 -- e.g., 99 vs 100 vs 101 and .099 vs .100 vs .101 .
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!