doublewu25
2008-04-04, 00:50
读取 头文件的各项信息,: 的前后值,并将后面的数据赋值给 info 数组。
哪位有此经验?
目前使用:
this_path = 'ttt.txt';
head = dlmread(this_path,':',[2 1 2 1]);
info = dlmread(this_path,' ',[5 0 7 9]);
首行有一个空行。
用 第一句 来单读文件头,好像只能读取数字,不然会报错,字符无法读取。help dlmread 说 reads numeric data,有别的读字符的类似函数吗?
第二句倒是可以,如果读取 500*500 的数据,还有什么更好的建议吗?
文件如:ttt.txt
Type: txt
Data: 20080326
Who: abc
Info:
1 2 3 4 5 6 7 8 9 10
2 3 4 5 6 7 1 8 9 10
4 5 6 7 8 1 2 3 9 10
哪位有此经验?
目前使用:
this_path = 'ttt.txt';
head = dlmread(this_path,':',[2 1 2 1]);
info = dlmread(this_path,' ',[5 0 7 9]);
首行有一个空行。
用 第一句 来单读文件头,好像只能读取数字,不然会报错,字符无法读取。help dlmread 说 reads numeric data,有别的读字符的类似函数吗?
第二句倒是可以,如果读取 500*500 的数据,还有什么更好的建议吗?
文件如:ttt.txt
Type: txt
Data: 20080326
Who: abc
Info:
1 2 3 4 5 6 7 8 9 10
2 3 4 5 6 7 1 8 9 10
4 5 6 7 8 1 2 3 9 10