how to replicate the array?

6 ビュー (過去 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 Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by