How to make a matrix from a vector?

1 次查看(过去 30 天)
Lev Mihailov
Lev Mihailov 2022-2-21
回答: KSSV 2022-2-21
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
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

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by