Reduce string length after check, with one line

2 次查看(过去 30 天)
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