How to save a figure with three - digit numbers or Time Stamps in folder

3 ビュー (過去 30 日間)
a.s
a.s 2020 年 7 月 19 日
コメント済み: Star Strider 2020 年 8 月 4 日
Hi, I want to save a figure of video in a folder (this frame grab on which color recognition processing has been done and frame name is img1.) and then order to besorted in the same folder in terms of order - digit numbers or Time Stamps.I already apologize that my english is not strong enough .
imwrite(img1,'orginimage.png');
for k=1:10;
img =img1;
baseFileName = sprintf('G:\abcd\rafe evejaj\pic%03d.png', k);
fullFileName = fullfile(baseFileName);
imwrite(img, fullFileName);
end
__________________________________________________________________---
> Error using imwrite (line 433)
Unable to determine the file format from the file name.
> Error in lkjhgfd2 (line 183)
imwrite(img, fullFileName);

採用された回答

Star Strider
Star Strider 2020 年 7 月 19 日
In order to print a backslant (\) character using sprintf (or its friends), it is necessary to ‘escape’ it by preceding it with a backslant character.
Try this:
baseFileName = sprintf('G:\\abcd\\rafe evejaj\\pic%03d.png', k);
.
  6 件のコメント
a.s
a.s 2020 年 8 月 4 日
hi,
Now the problem I have is that an image has been repeated several times and has been saved in three digit number , and every time the run is processed , the new photo replaces the previous shots .
My program is that when the program is run and the screenshot is taken from the video(for example 10 times) then the video stops and then the program is run again and The program runs this way up to 20 times.
I want the photos to be saved in order in all these steps and not to be replaced.
thank you for your help.
Star Strider
Star Strider 2020 年 8 月 4 日
I am not certain what the problem actually is.
One option is to include a date (and time) or other uniquely identifying information along with the serial identification number. That simply requires an additional field in the sprintf format string, and that the additional information be supplied as an argument to the sprintf call.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by