フィルターのクリア

Create a table/matrix of strings

2 ビュー (過去 30 日間)
cat cat
cat cat 2016 年 1 月 25 日
回答済み: Guillaume 2016 年 1 月 25 日
Hi!
I have a cell array with these strings:
'(43)2'
'(43)42(34)'
'042123'
From them, I want to obtain a matrix or a table like this
(43) (43)2
(43) (43)4 (43)42 (43)42(34)
0 04 042 0421 04212 042123
Can you help me?

採用された回答

Guillaume
Guillaume 2016 年 1 月 25 日
Here is one way to do it:
c = {'(43)2'
'(43)42(34)'
'042123'};
substrings = regexp(c, '(?:\(\d+\))|\d', 'match');
result = cellfun(@(ss) arrayfun(@(n) [ss{1:n}], 1:numel(ss), 'UniformOutput', false), substrings, 'UniformOutput', false)

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