How to make a matrix from a vector?

There is a simple vector, is it possible to make a matrix out of it somehow?
v=[ 1 2 3 4];
m=[[ 1 2 3 4],[ 1 2 3 4],[ 1 2 3 4],[ 1 2 3 4],[ 1 2 3 4],[ 1 2 3 4]] ; % you need to get a 6x4 matrix

回答 (1 件)

KSSV
KSSV 2022 年 2 月 21 日

0 投票

v = [1 2 3 4] ;
iwant = repmat(v,6,1)
iwant = 6×4
1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品

タグ

質問済み:

2022 年 2 月 21 日

回答済み:

2022 年 2 月 21 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by