Reduce string length after check, with one line

6 vues (au cours des 30 derniers jours)
Veronica Taurino
Veronica Taurino le 27 Août 2020
Commenté : Veronica Taurino le 27 Août 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!

Réponse acceptée

Stephen23
Stephen23 le 27 Août 2020
x = x(1:min(5,end))

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by