I am trying to write an Octave script that I can run as an executable.
I am using octave version 3.6.0. I am running the following script downloaded form here:
#!/usr/local/bin/octave -qf
# An example Octave script
len = input( "What size array do you wish to use for the evaluation: " );
clear a;
tic();
for i=1:len
a(i) = i;
endfor
time1 = toc();
a = [1];
tic();
for i=2:len
a = [a i];
endfor
time2 = toc();
a=zeros( len, 1 );
tic();
for i=1:len
a(i) = i;
endfor
time3 = toc();
printf( "The time taken for method 1 was %.4f seconds\n", time1 );
printf( "The time taken for method 2 was %.4f seconds\n", time2 );
printf( "The time taken for method 3 was %.4f seconds\n", time3 );
However when I run the script on the command line, I get the following error:
'usr/local/bin/octave: invalid option -- '
However, when I type the same command at the command line:
/usr/local/bin/octave -qf
I get the octave command prompt. What am I doing wrong?