title: Array indices must be positive integers or logical value when read images in matlab
body: <p>trying to read multi images in matlab in loop so error Array indices must be positive integers or logical values is appear </p>
  
  <pre><code>
  for i=1:12  % we have 16 images we have in or folder
  clc;clear;
  images ='/home/mohamed/Downloads/Lab6-20200415/Lab6-20200421/Lab6/Lab6/';
  jpgfiles=dir(fullfile(images,'\*.jpg*'));
  n=numel(jpgfiles(i));
  im=jpgfiles(i).name;
  im1=imread(fullfile(images,im));
  d1 = rg2gray(iml);
  imshow(im1);
  end
  
  </code></pre>