I have a column with housenumbers. Like:
str = ["54","33", "104A",...]
I want to split it in two columns
Numbers = ["54","33", "104",...]
Letters = ["","", "A",...]

1 件のコメント

Walter Roberson
Walter Roberson 2022 年 8 月 10 日
https://www.mathworks.com/help/matlab/ref/extract.html

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

 採用された回答

Stephen23
Stephen23 2022 年 8 月 10 日

0 投票

str = ["54","33","104A"];
tkn = regexp(str,'^(\d+)\s*(\w*)$','tokens','once');
tkn = vertcat(tkn{:});
num = tkn(:,1)
num = 3×1 string array
"54" "33" "104"
let = tkn(:,2)
let = 3×1 string array
"" "" "A"

その他の回答 (0 件)

カテゴリ

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

製品

リリース

R2022a

質問済み:

2022 年 8 月 10 日

回答済み:

2022 年 8 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by