Reduce string length after check, with one line

4 visualizaciones (últimos 30 días)
Veronica Taurino
Veronica Taurino el 27 de Ag. de 2020
Comentada: Veronica Taurino el 27 de Ag. de 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!

Respuesta aceptada

Stephen23
Stephen23 el 27 de Ag. de 2020
x = x(1:min(5,end))

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by