如何替换 Octave 中的 MATLAB 函数 table 和 table2array?
How to replace the MATLAB functions table and table2array in Octave?
我想在 Octave 中 运行 我的 MATLAB 脚本,但是 table
函数有问题,Octave 中尚不存在。
我要使用的 table 的摘录如下所示:
Rotation angle Measured distance
-0,342 0,000
-1,440 0,000
-10,422 0,000
-11,574 0,000
-21,060 0,000
-21,528 0,000
-30,402 0,000
为了创建我的输出变量,我在 MATLAB 中使用了以下代码。
data = table;
data.Rotationangle = cell2mat(raw(:, 1));
data.Measureddistance = cell2mat(raw(:, 2));
然后在 Octave 中出现以下错误。
warning: the 'table' function is not yet implemented in Octave
Please read <https://www.octave.org/missing.html> to learn how you can
contribute missing functionality.
error: 'table' undefined near line 102 column 8
error: called from
Cloud_reconstruction at line 102 column 6
我现在的问题是,是否有机会替换 Octave 中的 table 功能?我试图用 Octave data frame
包找到一个解决方案,但并没有真正做到。
在同一个脚本中,我还使用了 table2array
函数,该函数也尚未在 Octave 中实现,稍后也会发生错误。
data = table2array(data);
如果有人能帮助我,我会很高兴。
您可以使用类似的语法为 "column" 结构索引
data = struct;
data.var1 = [1;2;3;4];
data.var2 = [5;6;7;8];
但是,您会丢失很多在 MATLAB 中可用的 table 特定操作。
如果您有上述数据,您可以使用 struct2array
而不是 table2array
来转换为矩阵
data = struct2array( data );
如果您无论如何都在使用 table2array
,您最终会得到一个矩阵,那么为什么不首先坚持使用矩阵呢?如果您的所有数据都是数字,通常它们的运算速度会更快。
data = [cell2mat(raw(:,1)), cell2mat(raw(:,2))];
编辑:看来 struct2array
也可能是来自 Octave 的 missing。但是,在缺少的 link 中,您可以找到几个具有等效功能的附件。
我邀请您试用我的 Tablicious 软件包,它提供了 table
、datetime
和相关 类.
的 Matlab 兼容 Octave 实现
我想在 Octave 中 运行 我的 MATLAB 脚本,但是 table
函数有问题,Octave 中尚不存在。
我要使用的 table 的摘录如下所示:
Rotation angle Measured distance
-0,342 0,000
-1,440 0,000
-10,422 0,000
-11,574 0,000
-21,060 0,000
-21,528 0,000
-30,402 0,000
为了创建我的输出变量,我在 MATLAB 中使用了以下代码。
data = table;
data.Rotationangle = cell2mat(raw(:, 1));
data.Measureddistance = cell2mat(raw(:, 2));
然后在 Octave 中出现以下错误。
warning: the 'table' function is not yet implemented in Octave
Please read <https://www.octave.org/missing.html> to learn how you can
contribute missing functionality.
error: 'table' undefined near line 102 column 8
error: called from
Cloud_reconstruction at line 102 column 6
我现在的问题是,是否有机会替换 Octave 中的 table 功能?我试图用 Octave data frame
包找到一个解决方案,但并没有真正做到。
在同一个脚本中,我还使用了 table2array
函数,该函数也尚未在 Octave 中实现,稍后也会发生错误。
data = table2array(data);
如果有人能帮助我,我会很高兴。
您可以使用类似的语法为 "column" 结构索引
data = struct;
data.var1 = [1;2;3;4];
data.var2 = [5;6;7;8];
但是,您会丢失很多在 MATLAB 中可用的 table 特定操作。
如果您有上述数据,您可以使用 struct2array
而不是 table2array
来转换为矩阵
data = struct2array( data );
如果您无论如何都在使用 table2array
,您最终会得到一个矩阵,那么为什么不首先坚持使用矩阵呢?如果您的所有数据都是数字,通常它们的运算速度会更快。
data = [cell2mat(raw(:,1)), cell2mat(raw(:,2))];
编辑:看来 struct2array
也可能是来自 Octave 的 missing。但是,在缺少的 link 中,您可以找到几个具有等效功能的附件。
我邀请您试用我的 Tablicious 软件包,它提供了 table
、datetime
和相关 类.