padColor = [bgColor bgColor bgColor];
padColor = reshape(padColor,1,1,3)开发者_高级运维;
How to do the above in a more compact way(less code/replication)?
ones(1,1,3)*bgColor
Alternatively, using repmat:
padColor = repmat(bgColor,[1,1,3])
Another one is:
padColor(:,:,1:3) = bgColor
精彩评论