strcat help

2 Ansichten (letzte 30 Tage)
James
James am 19 Aug. 2011
Kommentiert: Walter Roberson am 19 Mai 2020
filename=strcat('frame',num2str(i),'.jpg')
This line is within a for loop so images are created with filenames...
frame1, frame2...frame50
How can I change this line of code so that it is... frame001, frame002 ... frame050

Akzeptierte Antwort

Jan
Jan am 20 Aug. 2011
filename = sprintf('frame%03d.jpg', i)

Weitere Antworten (2)

Walter Roberson
Walter Roberson am 19 Aug. 2011

Micky Elias
Micky Elias am 19 Mai 2020
filename=strcat(num2str(img,'%04i'),'.jpg');
  1 Kommentar
Walter Roberson
Walter Roberson am 19 Mai 2020
%03i not %04i for the user question.

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by