regexprep() skip first occurrence
조회 수: 2 (최근 30일)
이전 댓글 표시
Is there a way to use regexprep() but skip the first occurrence of a space?
mystring = 'this is my string';
desired return:
mystring2 = 'this ismystring';
댓글 수: 0
채택된 답변
Akira Agata
2019년 3월 13일
How about using regexp to find the position of spaces, and delete 2nd~Nth spaces? Like:
mystring = 'this is my string';
pos = regexp(mystring,'\s');
mystring(pos(2:end)) = [];
추가 답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!