remove decimals from title when using sprintf
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Joel
le 11 Avr 2023
Réponse apportée : Les Beckham
le 11 Avr 2023
I have this to my figure
Q=2021; %year
plot(x,y)
title(sprintf('text %f',Q))
But the title is
text 2021.00000000
How do I remove the decimals?
0 commentaires
Réponse acceptée
Les Beckham
le 11 Avr 2023
Q=2021; %year
x = 0:10;
y = x.^2;
plot(x,y)
grid on
title(sprintf('text %d',Q)) % <<< replace %f with %d
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Title 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!