开发者

What does padColor(:,:,1) mean in MatLab?

开发者 https://www.devze.com 2022-12-26 00:19 出处:网络
>> padColor = [1 1 1];%# RGB triple for pad color padColor = reshape(padColor,1开发者_如何转开发,1,3);
>> 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消