Thursday, July 30, 2009

Matlab, how to turn column vector c into matrix [c c c ... ] with 25 columns of c.?

c = [1; 2; 4; 5];





need a matrix M of 25 columns of c


1 1 1 ...


2 2 2 ...


4 4 4 ...


5 5 5 ...





Is there a way to do it without explicitly specifying the columns M = [c c c c ...]?

Matlab, how to turn column vector c into matrix [c c c ... ] with 25 columns of c.?
The command you are is repmat. It stands for replicate matrix. I think (but could be wrong) that the format you are looking for looks like this:





repmat(c,25,1)





check the command help





help repmat

edible flowers

No comments:

Post a Comment