strcat help

2 ビュー (過去 30 日間)
James
James 2011 年 8 月 19 日
コメント済み: Walter Roberson 2020 年 5 月 19 日
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

採用された回答

Jan
Jan 2011 年 8 月 20 日
filename = sprintf('frame%03d.jpg', i)

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2011 年 8 月 19 日

Micky Elias
Micky Elias 2020 年 5 月 19 日
filename=strcat(num2str(img,'%04i'),'.jpg');
  1 件のコメント
Walter Roberson
Walter Roberson 2020 年 5 月 19 日
%03i not %04i for the user question.

サインインしてコメントする。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by