A Sprintf For Loop Breakdown
Show older comments
Hi all I am seeking assitance in understanding the following code and the sprintf statement!
I googled and youtubed this but still I don't get this can someone assist me, please?
I don't understand the sprintf what does the %3.3d.jpg do?
So far what I understanding is that this statement prints a minimum of 3 files but what does the %3.3d.jpg????!!!!??
Lastly the numFramesWritten1 = numFramesWritten1 + 1; What does the 1 do?!!!?? add 1 to every frame that is being written???
I don't get it!!!!???!!
Please help!
My code:
% Deploying For Loop To Traverse & Process From Frame '1' To 'last' Frame
for t = 1 : numFrames1
currFrame1 = read(filename1, t); % Reading Individual Frames
opBaseFileName1 = sprintf('%3.3d.jpg', t);
opFullFileName1 = fullfile(Violence3, opBaseFileName1);
imwrite(currFrame1, opFullFileName1, 'jpg'); % Saving Frames As 'jpg' Files
Indicating Current Progress Of Files/Frames Written
%Writing the minimum digits to be printed using 4decimal notations signed
progIndication1 = sprintf('Writing Frame %4d of %d.', t, numFrames1);
disp(progIndication1);
numFramesWritten1 = numFramesWritten1 + 1;
end
Accepted Answer
More Answers (0)
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!