Matlab dates and time not aligning after combining
古いコメントを表示
My end goal is to plot discharge over time with a large dataset. The sample interval for discharge is in minutes and changes from every 5 hours to every 5 minutes a couple years into data collection. I have created a table containing date and time combined and discharge. For some reason when I do this minutes will return to 0 randomly. I am not sure how to fix this so my plot will look normal. The file is too large I cannot import it so I attcahed a screenshot of the original data table and of T. Thanks in advance!!


dataTable = readtable(csvFilePath);
Date=datetime(dataTable{:,16})+minutes(dataTable{:,9});
Discharge=dataTable(:,10);
Q =[Discharge]
Hour=dataTable(:,9)
T_cell = table2array(Q);
Hour_cell=table2array(Hour);
times = datenum(Hour_cell);
t = table(Date,times);
dates = datetime(t.Date,'Format','MM/dd/yyyy HH:mm:SS');
times = datetime(t.times,'ConvertFrom','datenum','Format','MM/dd/yyyy HH:mm:SS');
fullt = dates+timeofday(times);
t.DatesNTimes = fullt;
T=table(fullt, T_cell);
3 件のコメント
Walter Roberson
2023 年 11 月 14 日
times = datenum(Hour_cell);
Why are you doing that? Your Hour_cell is an array of numbers like 900 and 1200. datenum() with numeric inputs expects that the inputs are serial date numbers -- number of full days since 00-Jan-0000 . With single column numeric input, the output would be the same number. What is the point ??
Callie
2023 年 11 月 14 日
Les Beckham
2023 年 11 月 14 日
Can you post a subset of the "too large" dataset that illustrates the issue?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Data Type Identification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

