Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore \n (newline characters)

I get a string which contains a sentence in two lines :

'hello this is my first.
program matlab'

and I want to change the sentence to be represend in on line:

'hello this is my first.program matlab'

How could I do it with matlab ?

like image 696
lola Avatar asked Feb 21 '23 01:02

lola


1 Answers

Replace all occurrences of \n to ''

   myNewSt = strrep(mySt,sprintf('\n'),'');

For example, type:

   strrep( sprintf('this is my \n string'),sprintf('\n'),'')
like image 162
Andrey Rubshtein Avatar answered Mar 06 '23 10:03

Andrey Rubshtein