Reduce string length after check, with one line

2 ビュー (過去 30 日間)
Veronica Taurino
Veronica Taurino 2020 年 8 月 27 日
コメント済み: Veronica Taurino 2020 年 8 月 27 日
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))
  1 件のコメント
Veronica Taurino
Veronica Taurino 2020 年 8 月 27 日
It works fine, thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by