how to replicate the array?

6 visualizaciones (últimos 30 días)
Muhammad
Muhammad el 21 de Ag. de 2021
Editada: TADA el 21 de Ag. de 2021
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

Respuesta aceptada

TADA
TADA el 21 de Ag. de 2021
Editada: TADA el 21 de Ag. de 2021
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

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by