Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MATLAB: Filling a matrix with each column being the same

I am trying to create a matrix that is 3 x n, with each of the columns being the same. What's the easiest way of achieving it? Concatenation?

like image 566
stanigator Avatar asked Mar 11 '10 09:03

stanigator


1 Answers

After

n=7
x=[1;2;3]

it's either

repmat(x,[1 n])

or

x(:,ones(1,n))
like image 133
AVB Avatar answered Sep 18 '22 11:09

AVB