title: Error with print(): "Output argument "varargout" (and maybe others) not assigned"
body: <p>I have been trying to write a simple script in MATLAB that plots an image, asks to user if they want to print it to a file, and (if yes) does this. However, I have met a strange error with the <code>print()</code> function. Here is my code:</p>
  <pre><code>plot(X, Y, 'red');
  
  choice = input('Do you want to print to file this 2D image ? [y/n] ', 'y');
  
  if(choice=='Y' || choice=='y')
  {
      print(hFig, '-dpng', strcat(filename, '.png'));
  }
  </code></pre>
  <p>If running, it stops inside the <code>if</code> statement with the error:</p>
  <blockquote>
  <p>Error in ==&gt; print at 161 err.message='';</p>
  <p>??? Output argument &quot;varargout&quot; (and maybe others) not assigned during
  call to &quot;C:\Programmi\MATLAB\R2010a\toolbox\matlab\graphics\print.m&gt;print&quot;.</p>
  <p>Error in ==&gt; istogramma at 30  print(hFig, '-dpng', strcat(filename, '.png'));</p>
  </blockquote>
  <p>Why am I getting this error and how can I avoid this?</p>