title: MATLAB save image from GUI using push button
body: <p>I want to save an image from a designated axes. I keep getting <code>You may not have permission to write</code> error. Here is my code for the save as push button:</p>
  
  <pre><code>axes(handles.axes3);
  [FileName, PathName] = uiputfile('*bmp', 'Save As');
  Name = fullfile(FileName, PathName);
  imwrite(handles.TReg, Name, 'bmp');
  </code></pre>
  
  <p>Also, <code>handles.TReg</code> is a transformed image defined on another function.</p>
  
  <p>I cannot seem to find my error here, any thoughts would be appreciated.</p>
  
  <p><strong>Edit</strong>
  If I use the code:</p>
  
  <pre><code>axes(handles.axes3);
  [FileName, PathName] = uiputfile('*bmp', 'Save As');
  Name = fullfile(FileName, PathName);
  imwrite(handles.TReg, 'Name', 'bmp');
  </code></pre>
  
  <p>The file will save as Name.bmp in the proper directory. However I did notice that when I try saving with the original code, the error also reads (I missed this bit sorry):</p>
  
  <pre><code>Can't open file "Image1\C:\Users\Shinobii\Documents\MATLAB\" for writing.
  </code></pre>
  
  <p>I think the pathname should read like</p>
  
  <pre><code>"C:\Users\Shinobii\Documents\MATLAB\Image1"
  </code></pre>
  
  <p>could this be the problem?</p>