how to remove trailing zeros after rounding a matrix?

64 vues (au cours des 30 derniers jours)
Deepthi B
Deepthi B le 21 Avr 2021
Commenté : Deepthi B le 21 Avr 2021
I need to round a matrix to two decimal places but I want to get rid of those trailing zeros after the decimal point. Even I want to use that matrix for plotting also? How to do it?

Réponses (1)

Stephan
Stephan le 21 Avr 2021
Modifié(e) : Stephan le 21 Avr 2021
format short
A = 1.23
A = 1.2300
format shortG
A = 1.23
A =
1.23
  5 commentaires
Stephan
Stephan le 21 Avr 2021
Can you provide the code?
Deepthi B
Deepthi B le 21 Avr 2021
x =1:1:12;
y = gcmmodels;
subplot(2,2,1)
heat(round(clusteringcoefficientfive,2), x, y,'%0.2f','FontSize', 11,'TickAngle', 0,'ShowAllTicks', true, 'TickFontSize', 10,'GridLines', ':');
subplot(2,2,2)
heat(round(clusteringcoefficientsix,2), x, y,'%0.2f','FontSize', 11,'TickAngle', 0,'ShowAllTicks', true, 'TickFontSize', 10,'GridLines', ':');

Connectez-vous pour commenter.

Catégories

En savoir plus sur Line Plots 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