| | 首页 | 文章中心 | 下载中心 | 本站特供 | 软硬件结合论坛 | 软硬件结合博客 | | |
![]() | |
| 您现在的位置: 中国软硬件结合技术网 >> 文章中心 >> 软件技术 >> Matlab应用 >> 正文 |
|
|||||
| Matlab数据文件处理小程序 | |||||
| 作者:黄文宇博士 文章来源: 点击数: 更新时间:2007-1-26 | |||||
| Matlab数据文件处理小程序 程序作者: 在实验中,处理记录数据文件是经常要做的,而用Matlab来处理是我最推崇的,方便快捷,数据文件格式任意设置,均可处理,如用下面格式保存的数据文本data.txt,用Matlab来处理,用 data.txt文件: ...... d+00005.00;v+00001.92;e+00003.08;u-0016;m+1004;t+0286; d+00005.00;v+00002.06;e+00002.94;u-0041;m+0988;t+0287; d+00005.00;v+00002.19;e+00002.81;u-0040;m+0947;t+0288; d+00005.00;v+00002.31;e+00002.69;u-0033;m+0907;t+0289; d+00005.00;v+00002.39;e+00002.61;u-0024;m+0874;t+0290; d+00005.00;v+00002.47;e+00002.53;u-0024;m+0850;t+0291; d+00005.00;v+00002.56;e+00002.44;u-0025;m+0826;t+0292; d+00005.00;v+00002.61;e+00002.39;u-0016;m+0801;t+0293; d+00005.00;v+00002.69;e+00002.31;u-0024;m+0785;t+0294; d+00005.00;v+00002.72;e+00002.28;u-0007;m+0761;t+0295; ..... 处理函数readprocess function readprocess(file) fid=fopen(file,'rt'); if(fid==-1) display('File not exist!'); return; end array=[]; while(~feof(fid)) str=fscanf(fid,'%s',1); if(length(str)>10) %d+00005.00;v+00002.72;e+00002.28;u-0007;m+0761;t+0295; col=sscanf(str,'d%f;v%f;e%f;u%f;m%d;t%d;'); array=[array col]; end end fclose(fid); dhead=array(1,:); head=array(2,:); 'r:',t,head,'b-'); 运行环境,Matlab5X 使用方法:readprocess data.txt 你可以根据需要处理。 |
|||||
| 文章录入:sxiaofeng 责任编辑:Polylove | |||||
| 【发表评论】【告诉好友】【打印此文】【关闭窗口】 | |||||
| 最新热点 | 最新推荐 | 相关文章 | ||
| |
| | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 管理登录 | | |
![]() |
Copyright ©2004 - 2006 中国软硬件结合技术网 91tech.net 91tech.cn 91tech.com 站长:Polylove |