开发者

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

开发者 https://www.devze.com 2022-12-26 04:04 出处:网络
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
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

精彩评论

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