Reputation: 75
for row = 1 : size(YourImage, 1)
thisRow = YourImage(row, :, :);
to_display(row,:,:) = thisRow;
image(to_display);
drawnow();
I am new to matlab and I know what this function is supposed to be doing but I can't figure out how, especially those two lines:
for row = 1 : size(YourImage, 1)
and I don't understand what is this supposed to do :(row, :, :)
Upvotes: 0
Views: 45
Reputation: 272
for row = 1 : size(YourImage, 1)
This iterates from 1, in step size of 1, to size(YourImage,1), which is the size of YourImage along dimension 1, which is the number of rows in YourImage. (Assuming YourImage to be a 2D matrix is fine, since the argument in a:b
should be scalars.)
Whenever :
is used as an argument of array position, it refers to all the elements in that dimension. For example test(:,i)
would return all the row values in column i
.
For the other functions listed in the code snippet, you should read the following links:
MATLAB has comprehensive documentation, please search through it for inbuilt functions you don't understand.
Upvotes: 3