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일

0 개 추천

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2022년 5월 22일

댓글:

2022년 5월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by