How to deleted Enter char

2 visualizzazioni (ultimi 30 giorni)
Xiaoning.Wang
Xiaoning.Wang il 27 Nov 2020
Commentato: Xiaoning.Wang il 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

Risposta accettata

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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Prodotti


Release

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by