use a loop to iterate through the number of columns in a matrix/array

1 view (last 30 days)
I combine two images together by doing this -
imshow([image1(:,1:125,: ) image2(:,126:end,: )]);
Now I want to make a loop that will iterate over all the column indices of my matrix.

Answers (2)

Drew how
Drew how on 18 Jul 2015
Edited: Walter Roberson on 18 Jul 2015
for col = 0: ????
imshow([image1(????) image2(????)]);
drawnow;
end

Walter Roberson
Walter Roberson on 18 Jul 2015
newimage = [image1(:,1:125,: ), image2(:,126:end,: )];
for K = 1 : size(newimage,2)
thiscolumn = newimage(:,K,:);
do something with the data
end

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!