Reduce string length after check, with one line

6 Ansichten (letzte 30 Tage)
Veronica Taurino
Veronica Taurino am 27 Aug. 2020
Kommentiert: Veronica Taurino am 27 Aug. 2020
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!

Akzeptierte Antwort

Stephen23
Stephen23 am 27 Aug. 2020
x = x(1:min(5,end))

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by