MATLAB Answers

How to set elements in 2D matrix to zero given Index ?

36 views (last 30 days)
RuiQi
RuiQi on 12 Jun 2017
Answered: Walter Roberson on 12 Jun 2017
gt_regions = regionprops(gt,'PixelList');
linearInd = sub2ind(size(gt), gt_regions(1).PixelList(:,2), gt_regions(1).PixelList(:,1));
Now how do I use this to set the matrix elements to zero ?
ans = gt(linearInd) == 0; ?

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 12 Jun 2017
gt(linearInd) = 0;

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags