How to read text file in matlab?

조회 수: 1 (최근 30일)
Mallikarjun Yelameli
Mallikarjun Yelameli 2017년 5월 11일
답변: Walter Roberson 2017년 5월 11일
I have a text file. The example file attached here. Could you tell me please how to read it in table format? The 'dlmread' format is not working, since it can accept only numerics. Is there any other way to read it in table format? Thank you.

채택된 답변

Walter Roberson
Walter Roberson 2017년 5월 11일
S = fileread('example.txt');
info = regexp(S, '(?<label>\w+),(?<value>[^;]+)', 'names');
YourTable = array2table(str2double({info.value}), 'VariableNames', {info.label});

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by