import data from .dat file

38 ビュー (過去 30 日間)
Turbulence Analysis
Turbulence Analysis 2023 年 10 月 31 日
コメント済み: Voss 2023 年 10 月 31 日
Hi,
I intend to read data from the .dat file. Here each data set is sperated by '&', so if I use below script, it just reads only the first eight rows. However, I need to read the entire data stored in the .dat file.
B=importdata('test.dat');
Output data = B.data;
  4 件のコメント
Star Strider
Star Strider 2023 年 10 月 31 日
Can you use the zip function to compress it and then upload it here?
Turbulence Analysis
Turbulence Analysis 2023 年 10 月 31 日
PFA

サインインしてコメントする。

採用された回答

Voss
Voss 2023 年 10 月 31 日
fn = unzip('test.zip')
fn = 1×1 cell array
{'test.dat'}
T = readtable('test.dat','FileType','text','Delimiter','\t','MultipleDelimsAsOne',true)
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.
T = 899×12 table
x_x T H2 N2 O2 CO H2O CO2 CH4 C2 n_image roi ___ ______ _____ ____ ____ ___ ____ ___ ___ ___ _______ ___ 0 293.18 99.7 0.11 0.1 -1 0.1 -1 -1 -1 1 0 1 297.42 99.64 0.2 0.08 -1 0.08 -1 -1 -1 1 1 2 296.23 99.74 0.1 0.08 -1 0.07 -1 -1 -1 1 2 3 297.42 99.48 0.19 0.26 -1 0.07 -1 -1 -1 1 3 4 290.86 99.7 0.08 0.14 -1 0.08 -1 -1 -1 1 4 5 297.43 99.68 0.16 0.08 -1 0.08 -1 -1 -1 1 5 6 288.27 99.49 0.09 0.27 -1 0.15 -1 -1 -1 1 6 7 288.65 99.68 0.11 0.11 -1 0.11 -1 -1 -1 1 7 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 0 1 293.08 99.7 0.14 0.08 -1 0.08 -1 -1 -1 2 1 2 299.51 99.72 0.08 0.1 -1 0.1 -1 -1 -1 2 2 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 3 4 287.08 99.72 0.12 0.08 -1 0.08 -1 -1 -1 2 4 5 292.26 99.76 0.08 0.08 -1 0.08 -1 -1 -1 2 5 6 291.93 99.48 0.16 0.09 -1 0.27 -1 -1 -1 2 6
  2 件のコメント
Turbulence Analysis
Turbulence Analysis 2023 年 10 月 31 日
Thank you very much !
Voss
Voss 2023 年 10 月 31 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by