Reduce string length after check, with one line

조회 수: 2 (최근 30일)
Veronica Taurino
Veronica Taurino 2020년 8월 27일
댓글: Veronica Taurino 2020년 8월 27일
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일
x = x(1:min(5,end))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by