Skip to main content
 首页 » 编程设计

python之有没有办法以 Octave 为单位指定命令行宽度

2025年05月04日7mate10pro

我想在 python 脚本中使用 Octave 作为“计算器”。目前我正在像这样运行 Octave :

octave -q --eval 'some code' 

并读取标准输出以解释结果。
但是,一旦矩阵达到一定宽度,我就会遇到问题,因此 Octave 开始使用列编号输出它们,如下所示:

ans = 
 
 Columns 1 through 5: 
 
   6.6264e-01   2.6142e-01   9.2413e-01   1.6814e-01   6.3117e-01       
 
Columns 6 and 7: 
 
   6.6392e-01   4.0483e-01 

这使得结果的解释有点困难。

有没有办法告诉octave不要拆分结果打印?

请您参考如下方法:

split_long_rows () 命令应该能够改变这种行为。来自documentation ,

Query or set the internal variable that controls whether rows of a matrix may be split when displayed to a terminal window