Reduce string length after check, with one line

2 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

Stephen23
Stephen23 il 27 Ago 2020
x = x(1:min(5,end))

Più risposte (0)

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by