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

4 vues (au cours des 30 derniers jours)
data3 = readtable('daily_cloud_free_data.csv');
  2 commentaires
Sachin
Sachin le 21 Mar 2023
Modifié(e) : Sachin le 21 Mar 2023
Could you please provide your output and what you want? Because it is working fine for me ?

Connectez-vous pour commenter.

Réponse acceptée

Stephen23
Stephen23 le 21 Mar 2023
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

Plus de réponses (1)

aakash dewangan
aakash dewangan le 21 Mar 2023
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 commentaire
Stephen23
Stephen23 le 21 Mar 2023
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};

Connectez-vous pour commenter.

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by