String array to matrix

4 ビュー (過去 30 日間)
Ádám Herpai
Ádám Herpai 2022 年 5 月 22 日
コメント済み: Ádám Herpai 2022 年 5 月 22 日
Hi,
I have data as a 12487x1 string which row's cointains data separated by tabulators. I want to make this into a matrix, where the tabulators separate the columns in the matrix.
Thnaks in advance

採用された回答

Matt J
Matt J 2022 年 5 月 22 日
編集済み: Matt J 2022 年 5 月 22 日
Here's an example with comma separators instead of tabs, but it would work the same way.
a=["1,2";"3,4"]
a = 2×1 string array
"1,2" "3,4"
c=arrayfun(@(z)strsplit(z,','),a,'uni',0);
out=str2double(vertcat(c{:}))
out = 2×2
1 2 3 4
  1 件のコメント
Ádám Herpai
Ádám Herpai 2022 年 5 月 22 日
Thanks!

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by