incorrect reading of a txt file

2 ビュー (過去 30 日間)
Alberto Acri
Alberto Acri 2024 年 1 月 30 日
回答済み: Dyuman Joshi 2024 年 1 月 30 日
I have this .txt file that I have to read in Matlab. The first line is text and the second line onwards are numbers.
Using 'importdata' I do not get the desired result. How come?

採用された回答

Dyuman Joshi
Dyuman Joshi 2024 年 1 月 30 日
I am not sure what the expected output is supposed to be, but you can use readtable -
in = readtable('test.txt','DecimalSeparator',',')
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
in = 3×9 table
numberDef A B C D E F GAr F_1 _________ _______ ______ _______ _ ______ _______ ______ ______ 5 -0.3935 0.3958 -0.0089 0 0.0135 -0.0017 0.0645 0.0645 12 -0.1664 0.2135 -0.0008 0 0.0002 -0.0001 0.0256 0.0256 15 -0.2771 0.2765 -0.0096 0 0.0035 -0.0009 0.0491 0.0491

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by