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 次查看(过去 30 天)
data3 = readtable('daily_cloud_free_data.csv');

采纳的回答

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

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by