简体   繁体   English

在八度中读取文件

[英]Read file in Octave

I need to read a data file into Octave that may have different numbers of elements in each line, while retaining the line separation. 我需要将数据文件读入Octave,每行中可能具有不同数量的元素,同时保留行间距。

For example, read in: 例如,阅读:

1 2 3 4 5  
6 7 8 9  
1 2 3  
4 5 6 7 8

How can I use scanf to obtain something like: 我如何使用scanf获得类似的内容:

 1 2 3 4 5  
 6 7 8 9 0  
 1 2 3 0 0  
 4 5 6 7 8

Your crosspost on the help mailinglist was answered from Przemek: http://permalink.gmane.org/gmane.comp.gnu.octave.general/57521 您在帮助邮件列表上的交叉帖子已由Przemek回答: http ://permalink.gmane.org/gmane.comp.gnu.octave.general/57521

dlmread("filename")

will do what you want. 会做你想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM