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

 채택된 답변

Walter Roberson
Walter Roberson 2020년 11월 27일

0 개 추천

a = regexprep(a, '[\r\n]', '')
or
a(ismember(a, [10 13])) = ''; %10 is newline, 13 is carriage return

댓글 수: 1

Xiaoning.Wang
Xiaoning.Wang 2020년 11월 30일
I like the solution, Thank you Walter Roberson

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

제품

릴리스

R2017b

질문:

2020년 11월 27일

댓글:

2020년 11월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by