Filter löschen
Filter löschen

data import from excel (csv)

51 Ansichten (letzte 30 Tage)
hafiz hashim
hafiz hashim am 25 Okt. 2019
Kommentiert: Star Strider am 25 Okt. 2019
Hi i import data from csv by using readtable command
T = readtable('Report.csv','HeaderLines',8);
the data comes in this form matlab.JPG
how can i seperate datetime in one column and reading in other seperate columns. i would be so grateful if someone could help me out in this
Thanks
  2 Kommentare
Guillaume
Guillaume am 25 Okt. 2019
Attach an example csv file.
hafiz hashim
hafiz hashim am 25 Okt. 2019
HI i have attached the file.
Thanks

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 25 Okt. 2019
This is perhaps a bit more complicated than it might be, however readtable does not import it properly, so other approaches are necessary:
[D,S] = xlsread('example.csv');
dtts = table(datetime(S(2:end,1), 'InputFormat', 'dd-MM-yy hh:mm:ss a ''GMT''', 'TimeZone', 'UTC'),'VariableNames',S(1,1));
dt = array2table(D, 'VariableNames',S(1,2:end));
T1 = [dtts,dt];
T1_Sample = T1(1:5,:) % Delete Later
producing:
T1_Sample =
5×8 table
timestamp MWS_TOTAL NEB_RWP1_Ladies_Flow_Meter NEB_CWS_METER NEB2_CWS_GENTS_FLOW NEB_CWS_LADIES_FLOW NEB_HWS_LADIES_FLOW NEB_MWS_1ST CANTEEN
____________________ _________ __________________________ _____________ ___________________ ___________________ ___________________ ___________________
20-Nov-2018 10:00:00 15063 1.0076e+06 12350 27269 6.58 36.56 4.8806e+05
20-Nov-2018 12:00:00 15067 1.0079e+06 12354 27274 6.58 36.56 4.881e+05
20-Nov-2018 12:15:00 15068 1.008e+06 12355 27277 6.58 36.56 4.8813e+05
20-Nov-2018 12:30:00 15069 1.008e+06 12356 27277 6.58 36.56 4.8813e+05
20-Nov-2018 12:45:00 15070 1.0081e+06 12356 27279 6.58 36.56 4.8814e+05
Experiment to get the result you want.
  2 Kommentare
hafiz hashim
hafiz hashim am 25 Okt. 2019
Thanks for your help
Star Strider
Star Strider am 25 Okt. 2019
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Import and Analysis finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by