在可执行的Octave脚本中,我想传递包含矩阵的文件的名称,并使gnu octave将该文件信息作为矩阵加载 . 我怎么做?
这是脚本应该是什么样子
#! /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
传递的文件将是一个矩阵,其中包含任意大小的矩阵,例如2x3
1 2 3
5 7 8
在命令行,脚本应该作为 ./myscript mymatrixfile 运行,其中 mymatrixfile 包含矩阵 .
这是我尝试执行上面用八度音程编写的脚本时得到的
[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]$
generators.xyz 是包含我需要的矩阵的文件