How to make sure number of digits remain same, padded if required
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Mohana Singh
le 22 Avr 2019
Modifié(e) : JULIEN BARBAUD
le 22 Avr 2019
I am assigning names in a loop of the form img000.png,img001.png and so on. I’m using strcat as follows:
%num=000 %strcat(‘img’,num2str(num),’.png’) %num=+1
How do I make the assignment of num so that it always remains 3 digits?
0 commentaires
Réponse acceptée
JULIEN BARBAUD
le 22 Avr 2019
Modifié(e) : JULIEN BARBAUD
le 22 Avr 2019
Try to use something like
img_name=sprintf('img%03d',num)
instead of the strcat line
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with MATLAB 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!