title: what should I do undefined function 'colon'..?
body: <p>I'm studying weed optimization algorithm of brain MRI images using Matlab R2017a. I obtained sample code from the <a href="https://www.mathworks.com/matlabcentral/fileexchange/26532-image-segmentation-using-otsu-thresholding" rel="nofollow noreferrer">Matlab File Exchange</a> of Weed Optimization Algorithm. When I rand code with a binary image, I got an error message: </p>
  
  <blockquote>
    <p>Undefined function 'colon' for input arguments of type 'uint8' and attributes 'full 3d real'.</p>
  </blockquote>
  
  <p>What should I do to solve this problem?</p>
  
  <p>This problem doesn't occur for some images. Sometimes, I get a matrix dimension error. Despite all errors, sample code works great 100%. </p>
  
  <pre><code>I=imread('brainxx.jpeg');
  x=graytresh(I);
  w=im2bw(I,x);
  
  for.....
    %min pixel value
    %max pixel value
         %image area[pixels]
              .....
            within-class variance (sum of weighted bg and fg variance)
            % lowest within-class variance = optimal threshold (t)
  
      %find and set the optimal threshold and generate binary image
           [dat,indx]=min(var_tot);
           opt_td = im2double(opt_t)...
  </code></pre>