How do I create a matrix with repeating values?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Walter Roberson
il 29 Feb 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 Commenti
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!