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

2 次查看(过去 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