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 Center および File ExchangeText Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by