Reduce string length after check, with one line

Hello!
I would like to reduce a string length after a check on the length itself, with one command. Is it possible? Something like:
x=x(length(x)>5)(1:5)
Thank you!

 채택된 답변

Stephen23
Stephen23 2020년 8월 27일

0 개 추천

x = x(1:min(5,end))

추가 답변 (0개)

카테고리

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

태그

질문:

2020년 8월 27일

댓글:

2020년 8월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by