Using Datetiim to produce array of time points
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Del Ventruella
el 3 de Mayo de 2017
Respondida: Del Ventruella
el 3 de Mayo de 2017
I'm trying to use the Datetime function to produce an array of data points to use as input to an array of impedance values to process and plot. I have entered 8 points for Year, Month, and Day. MATLAB claims this is what it wants, even while it denies the Datetime function and won't work. How can I get this data entered into numerical Year,Month, Day for plotting and analysis?
The datetime function is described here:
https://www.mathworks.com/help/matlab/ref/datetime.html
Thanks.
Sincerely,
Del Ventruella
{ >> Y=[2000;2007;2009;2011;2012;2013;2014;2015]
Y =
2000
2007
2009
2011
2012
2013
2014
2015
>> M = [2;2;2;4;8;11;12;11]
M =
2
2
2
4
8
11
12
11
>> D = [12,17,14,16,8,11,13,14]
D =
12 17 14 16 8 11 13 14
>> X = datetime(Y,M,D) Error using datetime (line 579) Data inputs must be the same size, or any of them can be a scalar.
>> len(Y)= len(Y)= ↑ Error: Expression or statement is incomplete or incorrect.
>> length(Y)
ans =
8
>> length(M)
ans =
8
>> length(D)
ans =
8
>> x = datetime(Y,M,D) Error using datetime (line 579) Data inputs must be the same size, or any of them can be a scalar. }
0 comentarios
Respuesta aceptada
Steven Lord
el 3 de Mayo de 2017
Look at the size of the variables Y, M, and D. One of these things is not like the others. Just because two arrays have the same number of elements or the same length does not mean they have the same size. Transpose your D variable and it will work.
0 comentarios
Más respuestas (2)
Ver también
Categorías
Más información sobre Dates and Time en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!