How to make a matrix from a vector?

1 Ansicht (letzte 30 Tage)
Lev Mihailov
Lev Mihailov am 21 Feb. 2022
Beantwortet: KSSV am 21 Feb. 2022
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

Antworten (1)

KSSV
KSSV am 21 Feb. 2022
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

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by