Before the loop, you preallocate your R, G, and B arrays
redColumn600s = zeros(vidHeight, numberOfFrames, 'uint8');
greenColumn600s = zeros(vidHeight, numberOfFrames, 'uint8');
blueColumn600s = zeros(vidHeight, numberOfFrames, 'uint8');
You get your single frame from this:
thisFrame = read(videoObject, frame);
so now you need to extract column 600. To get the 3 colors separately, you'd do this:
column600R = thisFrame(:, 600, 1);
column600G = thisFrame(:, 600, 2);
column600B = thisFrame(:, 600, 3);
Then stuff those into your cumulative arrays
redColumn600s(:, frame) = column600R;
greenColumn600s(:, frame) = column600G;
blueColumn600s(:, frame) = column600B;
(You could combine the last two code chunks if you want to eliminate the temporary vector variables.)
Best Answer