For Loop not advancing
Posted
by
shizishan
on Stack Overflow
See other posts from Stack Overflow
or by shizishan
Published on 2014-06-10T22:38:51Z
Indexed on
2014/06/11
3:25 UTC
Read the original article
Hit count: 96
I'm trying to read in a large number of jpg
files using a for
loop. But for some reason, the k
index is not advancing. I just get A
as a 460x520x3 uint8. Am I missing something?
My goal with this code is to convert all the jpg
images to the same size. Since I haven't been able to advance through the images, I can't quite tell if I'm doing it right.
nFrames = length(date); % Number of frames.
for k = 1:nFrames-1 % Number of days
% Set file under consideration
A = imread(['map_EUS_' datestr(cell2mat(date_O3(k)),'yyyy_mm_dd') '_O3_MDA8.jpg']);
% Size of existing image A.
[rowsA, colsA, numberOfColorChannelsA] = size(A);
% Read in and get size of existing image B (the next image).
B = imread(['map_EUS_' datestr(cell2mat(date_O3(k+1)),'yyyy_mm_dd') '_O3_MDA8.jpg']);
[rowsB, colsB, numberOfColorChannelsB] = size(B);
% Size of B does not match A, so resize B to match A's size.
B = imresize(B, [rowsA colsA]);
eval(['print -djpeg map_EUS_' datestr(cell2mat(date_O3(k)),'yyyy_mm_dd') '_O3_MDA8_test.jpg']);
end
end
© Stack Overflow or respective owner