MATLAB: Combining 2 Matrixes to Run in Large Data Set

arraybig datamatrixtime

I have already ran a successful code that starts and stops at a specific time from a very large data set, with each comma separating the time by day. (i.e. the day 1 data runs from 48009 seconds to 66799 seconds, day 2 from 52467 s to 61999, etc.) Shown below:
utcStarts = [48009, 52467, 54128, 54591, 45001, 55587, 56714];
utcEnds = [66799, 61999, 59999, 57999, 45002, 74999, 61499];
I am attempting to run the same code but with two time periods during each day, like this below:
utcStarts = [48009, 52467, 54128, 54591, 45001, 55587, 56714]; utcEnds = [66799, 61999, 59999, 57999, 45002, 74999, 61499];
utcStarts = [730001, 72001, 74001, 80001, 45003, 82001, 68001]; utcEnds = [77659, 80271, 80894, 86181, 74428, 87252, 78116];
i.e. where day 1 will run from 48009 s to 66799 s and again from 73001 to 77659 s, day 2 from 52467 s to 61999 s and again from 72001 s to 80271 s.
Now that I am trying to run the same code for two time periods, I am getting an error which says: "The value assigned to the variable 'utcStarts' and 'utcEnds' might be unused."
What function can I use to combine the two matrixes and run the code for the two different time periods for each day?
Thank you.

Best Answer

Does it make sense to
1.- assign clearly differentiated names to both time windows of interest. Instead of calling them both utcStart and utcEnd, let's call
utcStarts1 = [48009, 52467, 54128, 54591, 45001, 55587, 56714];
utcEnds1 = [66799, 61999, 59999, 57999, 45002, 74999, 61499];
and
utcStarts2 = [730001, 72001, 74001, 80001, 45003, 82001, 68001];
utcEnds2 = [77659, 80271, 80894, 86181, 74428, 87252, 78116];
2.- now replace
goodPoints = find((utcTime >= utcStarts(jj)) &( utcTime <utcEnds(jj)));
with
goodPoints1=[utcStarts1(jj):1:utcEnds1(jj)]
goodPoints2=[utcStart2(jj):1:utcEnds2(jj)]
goodPoints=[goodPoints1 goodPoints2]
now goodPoints contains both time windows of interest.
What you may want to do next, is to add some code to make sure that when both windows overlapping, or 2nd window earlier than the 1st one, some correction is applied so that goodPoints contains all the increasing time points of interest.
Hope it helps
regards
John
Related Question