Putting 1 around the matrix
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi I have a 3X3 matrix and want to put 1 around the matrix as it will become 4X4 matrix.....
댓글 수: 3
채택된 답변
Andrei Bobrov
2016년 9월 23일
Let A - your matrix [3 x 3]:
A = magic(3);
out = ones(2 + size(A));
out(2:end-1,2:end-1) = A;
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!