×
嵌入式开发 > 详情

Matlab文件操作示例

发布时间:2020-07-08 发布时间:
|

Matlab文件操作示例

问题1:如何在matlab中读取数据文件将如下格式的数据文件data.txt装载到内存中,并生成一个二维数组1	0.0002	22	0.0004	33 	0.3	4输入命令“load -ascii data.txt”,此时数组data已经存在,输入命令“data”可以察看data>> load -ascii data.txt>> datadata =1.0000    0.0002    2.00002.0000    0.0004    3.00003.0000    0.3000    4.0000>> 问题2:如何将数组的数据保存到数据文件?Use the Save command.Save the data in ASCII form using the save 
command with the -ascii option. For example,A = rand(4,3);save temp.dat A -asciicreates an ASCII file called temp.dat containing1.3889088e-001  2.7218792e-001  4.4509643e-0012.0276522e-001  1.9881427e-001  9.3181458e-0011.9872174e-001  1.5273927e-002  4.6599434e-0016.0379248e-001  7.4678568e-001  4.1864947e-001


『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
五大标准轻松搞定4K超高清电视选购