【发布时间】:2012-03-17 16:52:43
【问题描述】:
我正在尝试编写一个可以作为可执行文件运行的 Octave 脚本。
我使用的是 octave 版本 3.6.0。我正在运行以下脚本下载表单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 );
但是,当我在命令行上运行脚本时,出现以下错误:
'usr/local/bin/octave: 无效选项 -- '
但是,当我在命令行输入相同的命令时:
/usr/local/bin/octave -qf
我得到八度命令提示符。我做错了什么?
【问题讨论】:
-
您能否将运行
/usr/local/bin/octave -qf your_script的结果添加到问题中?