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