matrix multiple line should be the same

hello i want to write a matrix in which the first two rows are equal and the third and fourth are also equal. so this is how it should look:
x = 1 2 3 4 5
1 2 3 4 5
6 7 8 9 10
6 7 8 9 10

답변 (1개)

DGM
DGM 2021년 4월 21일

0 개 추천

x = [1 2 3 4 5;
6 7 8 9 10]
% replicate elements in 2x1 blocks
xx = repelem(x,2,1)
gives
xx =
1 2 3 4 5
1 2 3 4 5
6 7 8 9 10
6 7 8 9 10
for replicating columns, just use
% replicate elements in 1x2 blocks
xx = repelem(x,1,2)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2021년 4월 21일

답변:

DGM
2021년 4월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by