tags:

views:

64

answers:

3
padColor = [bgColor bgColor bgColor];
padColor = reshape(padColor,1,1,3);  

How to do the above in a more compact way(less code/replication)?

+6  A: 
ones(1,1,3)*bgColor
KennyTM
+3  A: 

Alternatively, using repmat:

padColor = repmat(bgColor,[1,1,3])
Jonas
+1  A: 

Another one is:

padColor(:,:,1:3) = bgColor
Amro