怎么将matlab中数据保存为txt或dat格式

问题描述:

怎么将matlab中数据保存为txt或dat格式
a =
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
保存后在文本文件中显示成
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
程序要怎么写,
以下这种不行,
a =[17 24 1 8 15;23 5 7 14 16 ;4 6 13 20 22 ;10 12 19 21 3 ;11 18 25 2 9 ]
save afile.txt -ascii a
afile.txt打开之后,是这样的:
1.7000000e+001 2.4000000e+001 1.0000000e+000 8.0000000e+000 1.5000000e+001
2.3000000e+001 5.0000000e+000 7.0000000e+000 1.4000000e+001 1.6000000e+001
4.0000000e+000 6.0000000e+000 1.3000000e+001 2.0000000e+001 2.2000000e+001
1.0000000e+001 1.2000000e+001 1.9000000e+001 2.1000000e+001 3.0000000e+000
1.1000000e+001 1.8000000e+001 2.5000000e+001 2.0000000e+000 9.0000000e+000
1个回答 分类:综合 2014-10-03

问题解答:

我来补答
try this:
>> dlmwrite('a.txt',a,'delimiter',' ','newline','pc')
>> !type a.txt
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
%read Matlab help to see the usage of function dlmwrite.
 
 
展开全文阅读
剩余:2000
上一页:解不等式