How to combine columns from large dataset to datetime with correct vector or doublestring?
2 views (last 30 days)
Show older comments
I am trying to combine date and time so that I can plot discharge over time. Year, month, day, and hour (in minutes) are in different columns. I have tried several this including
Date=datetime(dataTable(:,3:5))+hours(data(:,8));
and get errors. For this it says
Input data must be a numeric array, a string array, a cell array containing character vectors, or a char matrix.
Any suggestions?
0 Comments
Accepted Answer
Star Strider
on 12 Nov 2023
Use curly brackets {} instead of parentheses when referring to numbered table variables —
Date=datetime(dataTable{:,3:5})+hours(dataTable{:,8});
dataTable = table(rand(2,1),rand(2,1),[2023;2023],[11;11],[10;11],rand(2,1),rand(2,1),[11;13])
Date=datetime(dataTable{:,3:5})+hours(dataTable{:,8})
.
2 Comments
Star Strider
on 12 Nov 2023
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
More Answers (0)
See Also
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!