Putting 1 around the matrix
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Offroad Jeep
le 23 Sep 2016
Commenté : Offroad Jeep
le 23 Sep 2016
Hi I have a 3X3 matrix and want to put 1 around the matrix as it will become 4X4 matrix.....
3 commentaires
Réponse acceptée
Andrei Bobrov
le 23 Sep 2016
Let A - your matrix [3 x 3]:
A = magic(3);
out = ones(2 + size(A));
out(2:end-1,2:end-1) = A;
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!