sprintf extra space character!
Mostra commenti meno recenti
Experts, I am trying to rename some images with the following code. The new names should be '1.jpg', '2.jpg' etc. However, I get ' 1.jpg', ' 2.jpg' etc. Note there is a space before each digit. What is the issue with my code?
a ='C:\Users\Faraz\Desktop\IBHS\Flame height\Frames\';
A =dir( fullfile(a, '*.jpg') );
fileNames = { A.name };
for iFile = 1 : numel( A )
newName = fullfile(a, sprintf( '%2d.jpg', iFile ) );
movefile( fullfile(a, fileNames{ iFile }), newName );
end
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Search Path in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!