title: Matlab: Saving multiple Dicom files as jpeg or png format
body: <p>I can read a Dicom format file and display it using <code>imshow()</code>. Then, manualy I can save the file into jpeg or png using <code>saveas</code> option. This works for one file at a time. However, I have around 1000 such dicom files. How can I save multiple dicom data files as jpeg format into another folder?</p>
  
  <p>This is how I read one file at a time:</p>
  
  <pre><code> X = dicomread('C:\Users\skm\Desktop\DicomRaw\578A0BF9');
  imshow(X);
  %Then from the figure I go to saveas option to save the file as jpeg.
  </code></pre>
  
  <p>This is what I have tried for multiple files</p>
  
  <pre><code>%read multiple images
  
  FileList = dir('C:\Users\skm\Desktop\DicomRaw\*.*');
  Converted_jpeg = dir('C:\Users\skm\Desktop\Jpeg_file\*.*');
  
  N = size(FileList,1);
  
  for k = 1:N
  
     % get the file name:
     filename = FileList(k).name
     disp(filename);
  
  end
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/oSMJQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oSMJQ.png" alt="pic"></a></p>