How to replace new line with white space in text documents

24 次查看(过去 30 天)
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', ' '))

采纳的回答

Stephen23
Stephen23 2016-1-31
编辑:Stephen23 2016-1-31
str = regexprep(test1,'\s+',' ');
or
str = regexprep(test1,'[\n\r]+',' ')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Database Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by