Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2008-11-06
年龄: 36
帖子: 4
声望力: 0 ![]() |
![]()
程序段为:
fid1=fopen('input.txt','rt'); s=fscanf(fid1,'%s'); fclose(fid1); 加入input.txt中内容为: Skip to content.Skip to bbc.co.uk navigation.Skip to bbc.co.uk search.The BBC is not responsible for the content of external internet sites. 结果为: s=Skiptocontent.Skiptobbc.co.uknavigation.Skiptobbc.co.uksearch.TheBBCisnotresponsibleforthecontentofexternalinternetsites. 读入的txt文件为一段纯英文字符串,读入工作空间后空格丢失,用了多种读入函数(dlmread,fread等)均无法解决,请教高人。 |
![]() |
![]() |
![]() |
#2 |
初级会员
注册日期: 2008-12-16
年龄: 40
帖子: 3
声望力: 0 ![]() |
![]()
是不是跟你选取的format,%s有关系,试试别的
|
![]() |
![]() |
![]() |
#3 |
初级会员
注册日期: 2008-11-26
年龄: 39
帖子: 4
声望力: 0 ![]() |
![]()
楼上说的对,把%s改为%c就可以了
fid1=fopen('input.txt','rt'); s=fscanf(fid1,'%c'); fclose(fid1); |
![]() |
![]() |
![]() |
|
|
![]() |
||||
主题 | 主题作者 | 版面 | 回复 | 最后发表 |
[求助]请各位高手进来帮忙,本人课题中遇到的一个方程组求解,不胜感激! | ncepuwanglin | MATLAB论坛 | 3 | 2009-03-07 20:31 |
[分享]给大家传一个图像空间变换和直方图变换的数学推导 | johnny8088 | MATLAB论坛 | 0 | 2009-01-31 03:26 |
Matlab声音合成和滤波的问题【附代码-自己写的】 | xmuer | MATLAB论坛 | 4 | 2008-12-17 08:58 |
[求助]电力系统机组启停优化算法程序 | woshi523de | MATLAB论坛 | 1 | 2008-11-18 08:12 |
[求助]在SIMULINK里,如何将inegrator上方的箭头移到下面去 | yijianmei | MATLAB论坛 | 1 | 2008-07-24 10:15 |