What does padColor(:,:,1) mean in MatLab?
>> padColor = [1 1 1]; %# RGB triple for pad color
padColor = reshape(padColor,1开发者_如何转开发,1,3);
>> padColor
padColor(:,:,1) =
1
padColor(:,:,2) =
1
padColor(:,:,3) =
1
What does padColor(:,:,1)
mean here?
After reshaping, padColor
is a 1-by-1-by-3 array. Since the size of the first two dimensions is 1, padColor(:,:,1)
, which means padColor("all","all",1) is equivalent to padColor(1,1,1)
. In other words, padColor(:,:,1)
is the element you find in the first row, first column, first 'z-slice' of padArray.
精彩评论