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

1 vue (au cours des 30 derniers jours)
i got a 6x6 matrix but now i have to make it 8x8 where the first two rows and column should be zero

Réponse acceptée

Kevin Holly
Kevin Holly le 16 Nov 2022
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

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by