在复制矩阵元素明智 [英] Replicate Element-wise in matrix

查看:103
本文介绍了在复制矩阵元素明智的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们说,我有:
A = [1 2; 3 4];

我要repmat的回报是:

I want to use repmat that return:

B = [1 1 2 2; 1 1 2 2; 3 3 4 4; 3 3 4 4]

请需要您的帮助。谢谢

Kindly need your help. Thank you

推荐答案

使用我不知道的方法 repmat 但这里是使用的方法 KRON

I do not know a method using repmat but here is a method using kron

kron([1 2 ; 3 4],[1 1;1 1])

ans =

 1     1     2     2
 1     1     2     2
 3     3     4     4
 3     3     4     4

这篇关于在复制矩阵元素明智的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆