开发者

What's the best short cut for this in MATLAB?

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
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜