Import text data with multiple delimiters

Hello, I have a badly structure data set in a text file, something like this:
[9.29509929e+02 4.88661114e+06 5.01623751e+03], 122158005196.00102,
[9.29509929e+02 4.88661114e+06 5.01623751e+03], 122158005196.00102,
[9.29509929e+02 4.88661114e+06 5.01623751e+03], 122158005196.00102,
[9.29498501e+02 4.88676967e+06 5.01635996e+03], 122079659456.75313,
How should I import this as a N-by-4 array? I usually use importdata('foo.txt') but it wouldn't work directly with multiple delimiters.

 채택된 답변

Walter Roberson
Walter Roberson 2021년 1월 6일

1 개 추천

table2array(readtable(FILENAME, 'Format', '[%f %f %f], %f,'))

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import and Export에 대해 자세히 알아보기

제품

릴리스

R2020a

태그

질문:

J T
2021년 1월 6일

답변:

2021년 1월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by