Clear Filters
Clear Filters

How to combine columns from large dataset to datetime with correct vector or doublestring?

1 view (last 30 days)
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
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?

Accepted Answer

Star Strider
Star Strider on 12 Nov 2023
Use curly brackets {} instead of parentheses when referring to numbered table variables —
dataTable = table(rand(2,1),rand(2,1),[2023;2023],[11;11],[10;11],rand(2,1),rand(2,1),[11;13])
dataTable = 2×8 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 _______ ________ ____ ____ ____ _______ _______ ____ 0.21309 0.038666 2023 11 10 0.32764 0.77161 11 0.22024 0.052536 2023 11 11 0.70769 0.31238 13
Date = 2×1 datetime array
10-Nov-2023 11:00:00 11-Nov-2023 13:00:00

More Answers (0)


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!