title: Pass a file name as a command line argument to GNU Octave script
body: <p>In an executable Octave script, I want to pass the name of a file containing a matrix and make gnu octave load that file information as a matrix. How do I do that?</p>
  
  <p>Here is what the script should look like </p>
  
  <pre><code>#! /usr/bin/octave -qf
  
  arg_list = argv()
  
  filename = argv{1} % Name of the file containing the matrix you want to load
  
  load -ascii filename % Load the information
  </code></pre>
  
  <p>The file passed will be a matrix containing a matrix of arbitrary size say 2x3</p>
  
  <pre><code>1 2 3
  5 7 8
  </code></pre>
  
  <p>At the command line the script should be run as <code>./myscript mymatrixfile</code>
  where <code>mymatrixfile</code> contains the matrix.</p>
  
  <p>This is what I get when I try to execute the script just written above with octave</p>
  
  <pre><code>[Desktop/SCVT]$ ./octavetinker.m generators.xyz                                                                             (05-14 10:41)
  arg_list =
  
  {
    [1,1] = generators.xyz
  }
  
  filename = generators.xyz
  error: load: unable to find file filename
  error: called from:
  error:   ./octavetinker.m at line 7, column 1
  
  [Desktop/SCVT]$  
  </code></pre>
  
  <p>Where <code>generators.xyz</code> is the file containing the matrix I need</p>