Simply use an "if" statement to see if the column is more than the number of columns in your image
rightColumn = 1000;
[rows, columns, numColors] = size(old);
if rightColumn > columns
rightColumn = columns;
end
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!