9
在可执行的Octave脚本中,我想传递包含矩阵的文件的名称,并使gnu八度将该文件信息加载为矩阵。我怎么做?将文件名作为命令行参数传递给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
在命令行脚本应该运行as ./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
是包含我需要
MATLAB中对应的代码是什么? – Celik