【发布时间】:2018-01-05 04:21:58
【问题描述】:
我有一个 .asc 文件“test.asc”,它由不同长度和内容的行组成。
my name is blalala
This is my home and I live in here
12 13 10 is he
he is my brother 12 13 14
如何将文件的内容导入 MATLAB 元胞数组,其中每一行都是由空格分隔符分隔的行?
resultCellarray={
'my' 'name' 'is' 'blalala' [] [] [] [] []
'This' 'is' 'my' 'home' 'and' 'I' 'live' 'in' 'here'
'12' '13' '10' 'is' 'he' [] [] [] []
'he' 'is' 'my' 'brother' '12' '13' '14' [] []
}
我尝试将每一行作为一个单元格插入:
content = textread('test.asc','%s','delimiter','\n','whitespace','');
然后将单元格分成几列,使用: separating cell array into several columns MATLAB,但是文件很大时会花费很多时间。最快的方法是什么?
【问题讨论】:
标签: matlab cell-array textreader