Would like help on how to change the values in a row and column of a 10x10 array?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jason
am 3 Nov. 2014
Kommentiert: Jason
am 3 Nov. 2014
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)
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 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".
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!