How to write the string after a spesific point in cell array?

Hello,
Lets say I have a text file and it contains
ASDASDDSA 123213213 ASDADASDA 18128, ASDSAD [ 123 123 123 12 3 123123 123 123]
I want to take the [ 123 123 123 12 3 123123 123 123] part of this cell array. How can I do that? Its like find([) and a = array(55:end, 1)
Thank you

1 件のコメント

Stephen23
Stephen23 2022 年 6 月 2 日
編集済み: Stephen23 2022 年 6 月 2 日
You say that you have a text file (please upload a sample file by clicking the paperclip button) but then the rest of your question talks about a cell array (which you do not describe). Unclear.
"I want to take the [ 123 123 123 12 3 123123 123 123] "
As text, or do you actually want the numeric values?

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

回答 (1 件)

Chunru
Chunru 2022 年 6 月 2 日

0 投票

s = 'ASDASDDSA 123213213 ASDADASDA 18128, ASDSAD [ 123 123 123 12 3 123123 123 123]'
s = 'ASDASDDSA 123213213 ASDADASDA 18128, ASDSAD [ 123 123 123 12 3 123123 123 123]'
t = regexp(s, '\[[\d\s]*\]', 'match')
t = 1×1 cell array
{'[ 123 123 123 12 3 123123 123 123]'}

カテゴリ

ヘルプ センター および File ExchangeFile Operations についてさらに検索

製品

リリース

R2021b

質問済み:

2022 年 6 月 2 日

編集済み:

2022 年 6 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by