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

8 Ansichten (letzte 30 Tage)
RuiQi
RuiQi am 12 Jun. 2017
Beantwortet: Walter Roberson am 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; ?

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Linear Algebra finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by