check new line
8 次查看(过去 30 天)
显示 更早的评论
hi my file: sfdgfhfgjj?? vvnnjkooupfdre
when read file using fopen and fscanf, them convert file into cell array
I found when there is new line this: [1x4 char]
if i want to check it if there in new line using:
if c(i,j)~='\n'
but did not work properly
thanks
1 个评论
Oleg Komarov
2011-12-10
It's about time you learned some basic principles on how to ask questions after more than 70 question...
回答(1 个)
Walter Roberson
2011-12-10
Please show the code you are using to open and scan the data. The method to check for end of line will depend on the details of your existing code.
MATLAB as a language does not recognize "escape sequences" such as \n and \t in strings (this is unlike C.) Instead, those sequences are recognized directly by the routines that deal with formatting strings, such as fscanf() and fprintf().
newline is generally coded either as char(10) or as sprintf('\n') but we will need to see what you have already to know whether either of those would be appropriate for your situation.
2 个评论
Walter Roberson
2011-12-11
That does not show the code to open or scan the data. I am looking for the fopen() and fscanf() calls and anything else that you do with the file.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Low-Level File I/O 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!