[英]octave error undefined near line 1 column 1
I try to read a matrix from a file. 我尝试从文件读取矩阵。 The code is very simple 代码很简单
function [mat] = read(file)
mat = load(file_points)
But when I try to run it 但是当我尝试运行它
read('file')
mat = 垫=
scalar structure containing the fields: 包含字段的标量结构:
mat =
3 4 6
3 5 1
it shows the matrix, but when I run this command... 它显示了矩阵,但是当我运行此命令时...
>>mat(1,1)
error: 'points' undefined near line 1 column 1 错误:“点”在第1行第1列附近未定义
From Octave Forge about load()
来自Octave Forge关于load()
If invoked with a single output argument, Octave returns data instead of inserting variables in the symbol table. 如果使用单个输出参数调用,则Octave返回数据,而不是在符号表中插入变量。 If the data file contains only numbers (TAB- or space-delimited columns), a matrix of values is returned. 如果数据文件仅包含数字(TAB或空格分隔的列),则返回值矩阵。 Otherwise, load returns a structure with members corresponding to the names of the variables in the file. 否则,load将返回一个结构 ,该结构的成员与文件中变量的名称相对应。
According to above, variable points is a (scalar) structure. 根据以上所述,可变点是(标量)结构。 However, if you use the_matrix_you_want = points.points;
但是,如果使用the_matrix_you_want = points.points;
you would retrieve matrix. 您将检索矩阵。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.