Effacer les filtres
Effacer les filtres

Would like help on how to change the values in a row and column of a 10x10 array?

2 vues (au cours des 30 derniers jours)
Given a 10 by 10 array of zero's named M2, change the values in row 3 and column 7 to all ones? This is how far I got but I cant seem to get it right... Any help would be appreciated
M2 = zeros(10, 10);
N = M2(3:end, 7:end);
col_row_Of_Ones = ones(N)

Réponse acceptée

Image Analyst
Image Analyst le 3 Nov 2014
No. Do it in two steps, once for the row, and once for the column. Here, I'll do the column for you.
M2(:, 7) = 1;
Get rid of your last two lines and do something similar to what I did, except that you will do it for row 3 and all columns. Remember ":" means "all".

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by