フィルターのクリア

I have a char array with code numbers separated by full stops and I want to extract all and save them in a single cell inside a matrix.

3 ビュー (過去 30 日間)
This may be rather easy for some of you. I have a char array with code numbers separated by full stops (see attached) and I want to extract the entire number (including all full stops) and save it in a single cell inside a matrix. I thought that there will be a quick way to do this but could not figure it out properly. Any ideas much appreciated!.

採用された回答

Stephen23
Stephen23 2018 年 4 月 27 日
編集済み: Stephen23 2018 年 4 月 27 日
Using regexp:
>> C = regexp(TempUid,'\d+\.','match');
>> C{:}
ans = 1.
ans = 3.
ans = 12.
ans = 2.
ans = 1107.
ans = 5.
ans = 2.
ans = 36.
ans = 40299.
Or if you also want to include the trailing number (with no period):
>> C = regexp(TempUid,'\d+\.?','match');
>> C{:}
ans = 1.
ans = 3.
ans = 12.
ans = 2.
ans = 1107.
ans = 5.
ans = 2.
ans = 36.
ans = 40299.
ans = 2014032012122937219119936
  2 件のコメント
GioPapas81
GioPapas81 2018 年 4 月 27 日
編集済み: GioPapas81 2018 年 4 月 27 日
So many thanks Stephen! And you have an easy way to merge all these different cells into a single cell please? Thank you very much again!
Stephen23
Stephen23 2018 年 4 月 27 日
編集済み: Stephen23 2018 年 4 月 27 日
"an easy way to merge all these different cells into a single cell please"
What "different cells"? C is already one cell array.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by