필터 지우기
필터 지우기

make matrix for given vector ( better method)

조회 수: 1 (최근 30일)
JaeSung Choi
JaeSung Choi 2017년 11월 21일
댓글: JaeSung Choi 2017년 11월 21일
for given vector x = [x1 x2 x3 x4 x5]
I want to make square matrix y = [x; x; x; x; x]
actually I can make it using
--------------------
for i = 1 : 5
y(i,:) = x
end
--------------------
but i have to do such calculation many times, so I want even fast method!
Please help me!!

채택된 답변

Birdman
Birdman 2017년 11월 21일
편집: Birdman 2017년 11월 21일
If x is a column vector:
Y=repmat(x,1,size(x,1));
If x is a row vector:
Y=repmat(x,size(x,2),1);
  댓글 수: 1
JaeSung Choi
JaeSung Choi 2017년 11월 21일
really thanks your answer saved me from waiting!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!