title: How can I get Octave to change the variables in my input files?
body: <p>I am trying to get Octave to change variables in my input files like it would if I were using the command line in Ubuntu. I've stripped this back to a simple case where I get it to change '1111' to the string Naer_str and '2222' to the string sigma_str; printing the result to a new file. 1111 and 2222 are both present in the first file. Here is the entire code I am running below.</p>
  
  <pre><code> Naer_str= num2str(1000)
  
   disp(Naer_str)
  
   sigma_str = num2str(0.491)
  
   eval(['system(''sed -e "s~1111~${Naer_str}~; s~2222~${sigma_str}~;" OctaveChangeVarTestFile.IN &gt; OctaveChangeVarTestFile_out.IN'');']);
  </code></pre>
  
  <p>The new input file is made, but rather than seeing the values 1000 and 0.491 as I anticipated the places where 0.491 and 1000 should be are blank. Running it in debug mode showed the follow error message (which I've seen a lot since I started to use Octave a few days ago, but I still don't really grasp what it means).</p>
  
  <pre><code> error: invalid use of script in index expression
  </code></pre>
  
  <p>I have tried just inputting stuff into the Linux terminal like so:</p>
  
  <pre><code> Naer_str=1000
  sigma_Str=0.491
   sed -e "s/1111/${Naer_str}/; s/2222/${sigma_str}/;" OctaveChangeVarTestFile.IN &gt; OctaveChangeVarTestFile_out.IN
  </code></pre>
  
  <p>This appears to work fine, so I assume that I must have made a grammar error either using system or eval, but I can't see it.</p>
  
  <p>What is causing this error message? Why am I not seeing my anticipated output?</p>