Cagri
Cagri

Reputation: 727

Create a MATLAB matrix

I want to create a matrix using QP = [20 22 28 35 50]

and make:

x = [20, 22, 28, 35, 50;
20, 22, 28, 35, 50;
20, 22, 28, 35, 50;]

I know how to make it manually, but I am looking for an efficient way to create such example.

Thanks

Upvotes: 0

Views: 45

Answers (1)

herohuyongtao
herohuyongtao

Reputation: 50717

Use repmat to repeat copies of array:

x = repmat(QP, 3, 1)

Upvotes: 2

Related Questions