matlab查找回车字符

 
Hi all,

I would like to read the data all at once with:
`file_text = fread(fid, inf, 'uint8=>char')`;
and then use strfind to get the indices of the new line characters. unfortunately my calls to strfind are only returning empty arrays:

    strfind(file_text,'\n')
    ans =[]

what am i doing wrong?

 
    strfind(data,'\n')

This searches for backslash and 'n'! So either use:


    strfind(data, sprintf('\n'))

or

    strfind(data, char(10));

And perhaps the file has DOS line breaks, then use:

    strfind(data, char([13, 10]));

posted @ 2013-10-14 16:29  秋天掰穗人  阅读(1506)  评论(0编辑  收藏  举报