title: Error using load command to open .mat file in Matlab
body: <p>Here's a part of my code where I am entering a name of the .mat file, which is located in the same folder as my code. However it does not identify the file name and gives an error: </p>
  
  <p>"??? Error using ==> load</p>
  
  <p>Unable to read file 'q.mat': No such file or directory."</p>
  
  <pre><code>q_type=input('Do you want to use q from "A", "B" or from a saved .mat file? Enter the exact name: ','s');
  q_type=mat2str([q_type'.mat'])
  load(q_type)
  </code></pre>
  
  <p>However if I use the load command in the command window directly as follow, then it gives no error and loads the file:</p>
  
  <p><code>load('q_A.mat')</code></p>
  
  <p>Why is it doing like this?</p>