matlab help

toughwimp11

Senior member
May 8, 2005
415
0
76
So let's say i have a 100x100 matrix full of zeros called 'init' and i want to change the zeros to a one at (5,8) and (7,3) and i have that in a matrix as pts=[5,8;7,3]. Is there a simple way to change the points? It definately seems like there should be and there probably is but i just dont know it. I tried init(pts(1,:),pts(2,:))=1; but that does every permutation (5,8) (5,3) (7,8) (7,3) which I dont want
 

Thyme

Platinum Member
Nov 30, 2000
2,330
0
0
for i = 1:length(pts),
init(pts(1,i),pts(2,i))=1
end

Something like that, though I don't have Matlab on me, so that might not work.