第1列第1行附近的八度音阶错误未定义 [英] 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)
但是当我尝试运行它时
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)
错误:点"在第1行第1列附近未定义
error: 'points' undefined near line 1 column 1
推荐答案
如果使用单个输出参数调用,则Octave返回数据,而不是在符号表中插入变量.如果数据文件仅包含数字(TAB或空格分隔的列),则返回值矩阵. 否则,加载将返回一个结构,其成员与文件中变量的名称相对应.
If invoked with a single output argument, Octave returns data instead of inserting variables in the symbol table. If the data file contains only numbers (TAB- or space-delimited columns), a matrix of values is returned. Otherwise, load returns a structure with members corresponding to the names of the variables in the file.
根据上面的描述,可变点是(标量)结构.
但是,如果使用the_matrix_you_want = points.points;
,则将检索矩阵.
According to above, variable points is a (scalar) structure.
However, if you use the_matrix_you_want = points.points;
you would retrieve matrix.
这篇关于第1列第1行附近的八度音阶错误未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!