title: MATLAB error: Function 'subsindex' is not defined for values of class 'struct'
body: <p>I tried these commands:</p>
  
  <pre><code>im=imread('untitled_test1.jpg');
  im1=rgb2gray(im);
  im1=medfilt2(im1,[15 15]);
  BW = edge(im1,'sobel'); 
  
  msk=[0 0 0 0 0;
   0 1 1 1 0;
   0 1 1 1 0;
   0 1 1 1 0;
   0 0 0 0 0;];
  B=conv2(double(BW),double(msk));
  
  Ibw = im2bw(B);
  CC = bwconncomp(Ibw); %Ibw is my binary image
  stats = regionprops(CC,'pixellist');
  
  % pass all over the stats
  for i=1:length(stats),
  size = length(stats(i).PixelList);
  % check only the relevant stats (the black ellipses)
  if size &gt;150 &amp;&amp; size &lt; 600 
      % fill the black pixel by white    
  
      x = round(mean(stats(i).PixelList(:,2)));
      y = round(mean(stats(i).PixelList(:,1)));
      Ibw = imfill(Ibw, [x, y]);
  
  else
      Ibw([CC.PixelIdxList{i}]) = false;
  end;
  end;
  </code></pre>
  
  <p>(here I have another command lines, but I guess the problem is not because of them.)</p>
  
  <pre><code>labeledImage = bwlabel(binaryImage, 8);     % Label each blob so we can make measurements of it
  blobMeasurements = regionprops(labeledImage, Ibw, 'all');   
  numberOfBlobs = size(blobMeasurements, 1); 
  </code></pre>
  
  <p>I got this error message:</p>
  
  <pre><code>??? Error using ==&gt; subsindex
  Function 'subsindex' is not defined for values of class 'struct'.
  
  Error in ==&gt; test2 at 129
  numberOfBlobs = size(blobMeasurements, 1);
  </code></pre>
  
  <p>What's going wrong?</p>