use Area
and PixelIdxList
in regionprops, this means to edit the to the following line:
stat = regionprops(Ilabel,'Centroid','Area','PixelIdxList');
The maximum area and it's struct index is given by
[maxValue,index] = max([stat.Area]);
The linear index of pixels of each area is given by `stat.PixelIdxList', you can use them to delete that given area (I assume this means to assign zeros to it)
YourImage(stat(index).PixelIdxList)=0;