change the number of digits after decimal point
Afficher commentaires plus anciens
Hi everybody
how can I change the number of digits after decimal point? I have a matrix of float numbers i want to transform each number in this matrix from this form x.xxxxxxxxxxxxxxx to this form x.xxxx
thanks
Réponse acceptée
Plus de réponses (2)
Image Analyst
le 30 Mai 2014
0 votes
(I should add this to the FAQ.)
4 commentaires
Image Analyst
le 30 Mai 2014
Modifié(e) : Image Analyst
le 29 Nov 2014
Then why don't you describe exactly what you're looking for? I see two possibilities: Do you want to (a) change each number by truncating digits after a certain number of decimal places, or (b) leave each number alone but just change how many digits are displayed when you display it in the command window or a static text label in a GUI?
I told you how to do (a). To do (b) you can use sprintf(), fprintf(), or format(). Which way, a or b, do you want to do?
Image Analyst
le 30 Mai 2014
Modifié(e) : Image Analyst
le 29 Nov 2014
You said you want (b) but then you say that you don't want to use sprintf() or format() or to use a string at all. Your last sentence indicates that you want it to stay a number not a string but that is option (a) and is the answer I gave you at the very start. Sorry but I still am not sure what you want. You're either changing the number (by chopping off digits) or you're not, which is it?
rahul bathini
le 26 Juin 2015
0 votes
I've made a simulation on BPSK modulation and semilogy plotted the SNR vs. BER. The plot is geometrically the same to the actual plot but deviates from BER = 0.00001.I think this is because matlab doesn't consider values below 4 decimal place while plotting , to what extent could this be the reason if not what could the reason be.plz someone help me
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!