how to create zero column matric and row in beginning of the matrix

조회 수: 1 (최근 30일)
i got a 6x6 matrix but now i have to make it 8x8 where the first two rows and column should be zero

채택된 답변

Kevin Holly
Kevin Holly 2022년 11월 16일
m = rand(6)
m = 6×6
0.0069 0.8937 0.6615 0.7778 0.8702 0.0865 0.6157 0.2651 0.6701 0.6399 0.4879 0.9692 0.0580 0.9024 0.5732 0.7527 0.4914 0.0875 0.0193 0.1431 0.6512 0.3485 0.3430 0.5308 0.1633 0.5451 0.9625 0.5715 0.0338 0.7193 0.4034 0.8196 0.9789 0.4078 0.5132 0.0587
new = [zeros(8,2) [zeros(2,6);m]]
new = 8×8
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0069 0.8937 0.6615 0.7778 0.8702 0.0865 0 0 0.6157 0.2651 0.6701 0.6399 0.4879 0.9692 0 0 0.0580 0.9024 0.5732 0.7527 0.4914 0.0875 0 0 0.0193 0.1431 0.6512 0.3485 0.3430 0.5308 0 0 0.1633 0.5451 0.9625 0.5715 0.0338 0.7193 0 0 0.4034 0.8196 0.9789 0.4078 0.5132 0.0587

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by