title: Automating inputs to Matlab
body: <p>I'm helping out with grading in a Matlab course this summer and one of the assignments consists of building a simple user interface for plotting functions and altering their appearance. All the input is done to the command-line, so the menus look something like:</p>
  
  <pre><code>=====================
  1. New function
  2. Change line-width
  3. Change line-style
  =====================
  </code></pre>
  
  <p>I always start out testing the same way when grading to test basic functionality:</p>
  
  <p>1, 2, sin(x)    (create a graph of sin(x) in window 2)</p>
  
  <p>1, 3, exp(x)    (create a graph of exp(x) in window 3)</p>
  
  <p>2, 3, 2         (change the line-width of plot number 3 to 2)</p>
  
  <p>3, 2, --        (change the line-style of plot number 2 to dashed)</p>
  
  <p>etc.</p>
  
  <p>Since the majority of hand-ins follow the same suggested menu structure it would make my life easier if there was a way to automatically do these inputs with a script instead of repeating the same sequence of numbers and letters over and over. The script itself doesn't have to be in Matlab although I'm guessing it would be practical since I need to check the resulting graphs manually (i.e. I need the input to be entered into the Matlab-command line).</p>
  
  <p>Basically I want Matlab to read the keystrokes "1 [enter] 2 [enter] sin(x) [enter] ..." to the command-line while running another Matlab-script.</p>
  
  <p>Any ideas?</p>