How do I fill in a matrix in this way?

1 vue (au cours des 30 derniers jours)
Nick Thomas
Nick Thomas le 21 Avr 2018
Commenté : Nick Thomas le 22 Avr 2018
I want to fill in a large matrix and know what certain rows/columns/areas are. For example, say I have a 900x900 matrix. The 300th row may be 400, and the space from the 3rd row to the 9th row in the 4th to 9th columns is 800. The rest could be 200. How do I create a matrix by knowing these things?

Réponse acceptée

Image Analyst
Image Analyst le 22 Avr 2018

Try this with your matrix, m

m = 200 * ones(200); % First initialize to all 200
m(300, :) = 400;  % Set row 300, all columns, to 400.
m(3:9, 4:9) = 800;  % Set this block to be all 800
  1 commentaire
Nick Thomas
Nick Thomas le 22 Avr 2018
Thank you! That helps a lot.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by