matlab查找回车字符

时间:2023-03-09 21:54:03
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]));