Borrar filtros
Borrar filtros

How to replace new line with white space in text documents

24 visualizaciones (últimos 30 días)
Hello,I am trying to change all new lines in my database with white space,but codes does not work.can any one help me please.Data base is attached.
test1 = fileread('part1.txt');
newTest = sprintf(strrep(test1, '\n', ' '))

Respuesta aceptada

Stephen23
Stephen23 el 31 de En. de 2016
Editada: Stephen23 el 31 de En. de 2016
str = regexprep(test1,'\s+',' ');
or
str = regexprep(test1,'[\n\r]+',' ')

Más respuestas (0)

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by