Matlab重复值 [英] Matlab Repeat Value

查看:112
本文介绍了Matlab重复值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是这个矩阵:

A = [2 3 4 6 7 8 9 1 2];

我需要将该矩阵更改为:

I need to change that matrix into:

B = [2 3 4 6 7 8 9 1 2;
     2 3 4 6 7 8 9 1 2;
     2 3 4 6 7 8 9 1 2]

输出将是:

B =

 2     3     4     6     7     8     9     1     2
 2     3     4     6     7     8     9     1     2
 2     3     4     6     7     8     9     1     2

非常感谢您...

推荐答案

repmat repelem 用于重复数组的副本.对于您的情况,可以将以下任意一种用作:repmat(A,3,1)repelem(A,3,1)

repmat and repelem are used for repeating the copies of an array. For your case, you can use either of these as: repmat(A,3,1) or repelem(A,3,1)

这篇关于Matlab重复值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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