how to replicate the array?

조회 수: 8 (최근 30일)
Muhammad
Muhammad 2021년 8월 21일
편집: TADA 2021년 8월 21일
i have an array
a = 1 2 3
4 5 6
7 8 9
now i want
a= 1 1 2 3 3
1 1 2 3 3
4 4 5 6 6
7 7 8 9 9
7 7 8 9 9
what command do it
as padarray pad the desire number arround the martix

채택된 답변

TADA
TADA 2021년 8월 21일
편집: TADA 2021년 8월 21일
a = [1, 2, 3; 4, 5, 6; 7, 8, 9];
b = a([1, 1, 2, 3, 3], [1, 1, 2, 3, 3])
b = 5×5
1 1 2 3 3 1 1 2 3 3 4 4 5 6 6 7 7 8 9 9 7 7 8 9 9
c = padarray(a, [1, 1], 'replicate', 'both')
c = 5×5
1 1 2 3 3 1 1 2 3 3 4 4 5 6 6 7 7 8 9 9 7 7 8 9 9

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by