What are the matlab equivalent for '\n' '\t' and other escape characters? [duplicate]

巧了我就是萌 提交于 2020-02-08 04:12:46

问题


I am reading a file using fileread() which returns me the entire file. Now I need to read line by line and convert them into process the data. Can I know how I would be able to detect the newline character in Matlab? I tried '\n' and '\r\n' and it doesn't work.

Thanks in advance


回答1:


I already replied here (please avoid posting the question twice)Escape characters in Matlab

For special acharacters either use the char function with the character code (http://www.asciitable.com/) or sprintf (my preferred way for better readability. For example you are looking for sprintf('\n') or sprintf('\r\n')

char(13) is carriage return \r char(10) is new line \n



来源:https://stackoverflow.com/questions/43177475/what-are-the-matlab-equivalent-for-n-t-and-other-escape-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!