Can I run a loop with image variables that have different dimensions?
1 view (last 30 days)
Show older comments
Jamil Wanis
on 24 Apr 2018
Commented: Jamil Wanis
on 26 Apr 2018
Apologies if there is an obvious answer I'm missing.
I've got images stored as variables, but they've got different dimensions.
I've got this function to calculate the average RGB value of each image:
mean(reshape(I1, [], 3))
But I don't know how to make a loop that will run through each variable. I've tried to make it a list like this
a = [I1 I2 I3 I4 I5 I6 I7 I8]
But the dimensions are not the same, and it would be ideal if I did not have to edit the images further. Any help, or do I need to resize?
0 Comments
Accepted Answer
Matt Macaulay
on 24 Apr 2018
Make a cell of the images and loop through the cell:
a = {I1 I2 I3 I4 I5 I6 I7 I8};
n = length(a);
for i = 1:n
% Do some stuff
end
2 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!