MATLAB: How to find “Enter” between the lines of a text and replace with “Alt+Enter”

MATLABsearch in txt find

Hello everyone.
I have a text file like below:
"
I am good.
how are you?
are you there?
ok
that's all
"
the text contains so many lines. I want to remove the Enter between the lines. I know this command:
strrep(str,'','');
but with this I can not replace something with enter!
Additionally, I need to replace Enter with "alt+enter" character. alt+ Enter is the character which is not affected in text in notepad and you see the all the sentences in a line, but separate lines in word or notepad ++
here is this character between ""
"
"
attention that this is not Enter. this is another character!!
hope that you get the point.
thanks

Best Answer

s = fileread('YourFileName.txt');
s(s == char(10)) = ''; %10 is control-J, newline
Caution: you might have carriage return (13) as well as newline.
Looking around, I find vague hints that what you are referring to as alt-enter is implemented as newline, char(10). notepad required carriage-return / newline pairs to recognize end-of-line, but word and notepad++ can be set to recognize linefeed alone. In such a situation it would be sufficient to delete the carriage returns
s(s == char(13)) = '';