How do I create a matrix with repeating values?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm trying to create a matrix with time values over 15 days increasing by 15 minute intervals. So it needs to be a 3x1536 matrix with a row for days, hours, and minutes.
the days row needs to have the value '0' for 96 times before it increase to 1, then 96 times again before it increases to 2 and so on..
the hours row needs to have the value 0 for 4 times before it increases to 2, then when after hour '23', it needs to start at 0 again..
and finally the minutes just need to [0 15 30 45], but repeating to the end. How do I do this??
0 comentarios
Respuestas (1)
Walter Roberson
el 29 de Feb. de 2012
dn = linspace(0, 16, 1536+1); %include midnight after
dn(end) = []; %remove midnight after
dv = datevec(dn);
Now extract appropriate columns of dv, probably columns 3, 4, and 5
0 comentarios
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices 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!