String Delimiting and Array Storage

1 回表示 (過去 30 日間)
Nikolay Rodionov
Nikolay Rodionov 2012 年 10 月 1 日
Hi, could someone tell me the best way to delimit a long single row array of characters based on a reoccurring character in the array? In this case I am using "/" to separate strings.
The biggest challenge I am having is storing delimited strings into an array because the string length is not constant.
I can have something like abc/adeht/ahdiglkjsad/asd/ds but I cannot create the following array
[adeht
ahdiglkjsad
asd
ds ]
because the strings are all different lengths and the dimensions do not match.
Can anyone recommend a solution? I need to be able to reference and analyze each string on a per character basis after delimiting. That's why I chose to try to do an array originally, however, this is not working out.
Thanks, Nikolay

採用された回答

Jan
Jan 2012 年 10 月 1 日
You can use a cell string:
str = 'abc/adeht/ahdiglkjsad/asd/ds';
cstr = regexp(str, '/', 'split');
  8 件のコメント
Matt Fig
Matt Fig 2012 年 10 月 1 日
C = {'asdlfdjsadf','awwretjrdf'};
C{2}(4:5)
Nikolay Rodionov
Nikolay Rodionov 2012 年 10 月 1 日
Thank you so much!

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

その他の回答 (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