when I using readtable to read .csv file all variable data get mixed, what are the reason for this and provide proper solution for this

3 ビュー (過去 30 日間)
data3 = readtable('daily_cloud_free_data.csv');
  2 件のコメント
Sachin
Sachin 2023 年 3 月 21 日
編集済み: Sachin 2023 年 3 月 21 日
Could you please provide your output and what you want? Because it is working fine for me ?

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

採用された回答

Stephen23
Stephen23 2023 年 3 月 21 日
There is no need to change the file format when you can simply specify the delimiter when importing:
T = readtable('daily_cloud_free_data.csv', 'Delimiter',',')
T = 761×2 table
date net_r ___________________ ______ 22.12.2018 00:00:00 319.74 23.12.2018 00:00:00 NaN 24.12.2018 00:00:00 333.44 25.12.2018 00:00:00 NaN 26.12.2018 00:00:00 NaN 27.12.2018 00:00:00 NaN 28.12.2018 00:00:00 NaN 29.12.2018 00:00:00 NaN 30.12.2018 00:00:00 NaN 31.12.2018 00:00:00 NaN 01.01.2019 00:00:00 NaN 02.01.2019 00:00:00 NaN 03.01.2019 00:00:00 NaN 04.01.2019 00:00:00 NaN 05.01.2019 00:00:00 NaN 06.01.2019 00:00:00 306.17
T = rmmissing(T)
T = 95×2 table
date net_r ___________________ ______ 22.12.2018 00:00:00 319.74 24.12.2018 00:00:00 333.44 06.01.2019 00:00:00 306.17 21.01.2019 00:00:00 272.1 25.01.2019 00:00:00 272.29 31.01.2019 00:00:00 221.75 16.02.2019 00:00:00 181.23 17.02.2019 00:00:00 175.04 18.02.2019 00:00:00 168.95 27.02.2019 00:00:00 145.91 01.03.2019 00:00:00 132.16 03.03.2019 00:00:00 129.37 05.03.2019 00:00:00 117.97 07.03.2019 00:00:00 111.59 08.03.2019 00:00:00 110.01 11.03.2019 00:00:00 99.042

その他の回答 (1 件)

aakash dewangan
aakash dewangan 2023 年 3 月 21 日
Try this format, in my work it works well :)
T = readtable('Acceleration with g 2023-03-15 23-30-50.xls');
time = (T(:,1)); % column 1
Acc = (T(:,4)); % column 4
time = table2array(time); % column 1 vector
Acc = table2array(Acc); % column 4 vector
  1 件のコメント
Stephen23
Stephen23 2023 年 3 月 21 日
This code:
time = (T(:,1));
Acc = (T(:,4));
time = table2array(time);
Acc = table2array(Acc);
is simpler using the correct curly-brace indexing:
time = T{:,1};
Acc = T{:,4};

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

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by