什么是matlab等效于'\''\t'和其他转义字符? [英] What are the matlab equivalent for '\n' '\t' and other escape characters?
问题描述
我正在使用fileread()读取一个文件,它将返回整个文件。现在我需要逐行阅读并将其转换成数据。我可以知道如何在Matlab中检测换行符?我试过'\'和'\\\\',它不起作用。
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.
提前感谢
推荐答案
我已经在这里回复(请避免发表两次问题) Matlab中的转义字符
I already replied here (please avoid posting the question twice)Escape characters in Matlab
对于特殊字符,可以使用带有字符代码的char函数( http://www.asciitable.com/ )或sprintf(我最喜欢的方式来提高可读性,例如你正在寻找sprintf '\\\
')或sprintf('\r\\\
')
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)是回车符\r char(10)是新行\\\
char(13) is carriage return \r char(10) is new line \n
这篇关于什么是matlab等效于'\''\t'和其他转义字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!