Clear Filters
Clear Filters

How to deleted Enter char

3 views (last 30 days)
Xiaoning.Wang
Xiaoning.Wang on 27 Nov 2020
Commented: Xiaoning.Wang on 30 Nov 2020
a = '
'MOVABLE,ERASABLE,
MERGEABLE'
a(18) = '
' % there hava a Enter char
I want to delete the Enter Char.
the way ('\n' or 'r' or '\r\n' ) is error. so how to delete the Enter char

Accepted Answer

Walter Roberson
Walter Roberson on 27 Nov 2020
a = regexprep(a, '[\r\n]', '')
or
a(ismember(a, [10 13])) = ''; %10 is newline, 13 is carriage return
  1 Comment
Xiaoning.Wang
Xiaoning.Wang on 30 Nov 2020
I like the solution, Thank you Walter Roberson

Sign in to comment.

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!