MATLAB: How to separate multiple daily data points into separate strings

datamultiplesort

Hello,
The lab data I'm analyzing is comprised of measurements from 2-3 daily shifts. Each shift, a different technician measures the data. I'd like to separate the data by technician. To do this, I need to take the first daily measurement and put in its own array or table cable. The same with the second daily measurement and so on.
I tried the "unique" function but it only picks the first or last daily data points. It doesn't work on days where there are three shifts and three data points.
Any thoughts on the best way to separate the data by shift?
Here's a sample of the data.
Date No. Value
12-Jul 20 171.5
13-Jul 21 182.3
13-Jul 22 167.6
14-Jul 23 161.1
14-Jul 24 183.5
15-Jul 25 176.5
15-Jul 26 185.3
16-Jul 27 190.2
16-Jul 28 179.9
17-Jul 29 168.1
17-Jul 30 177.6
18-Jul 31 167.5
18-Jul 32 187
18-Jul 33 174
19-Jul 34 162
19-Jul 35 168.3
20-Jul 36 170.8
20-Jul 37 172.4
21-Jul 38 160.3
21-Jul 39 173.4
22-Jul 40 166.1
24-Jul 41 168.8
24-Jul 42 148.9
25-Jul 43 177.3
25-Jul 44 176
26-Jul 45 174.5
26-Jul 46 161.6
27-Jul 47 175.2
27-Jul 48 161.6
28-Jul 49 163.1
28-Jul 50 159
29-Jul 51 171.6
29-Jul 52 167
31-Jul 53 167.1
31-Jul 54 159.2
Thanks for your help!

Best Answer

t = readtable('Sample data for sorting by shift.xls', 'readvar',false);
t2 = [t; table(NaT, nan, nan)];
shift3_idx = find(t2.Var1(1:end-2) == t2.Var1(2:end-1) & t2.Var1(1:end-2) == t2.Var1(3:end))+2;
shift3_data = t(shift3_idx,:);
shift2_idx = setdiff(find(t2.Var1(2:end) == t2.Var1(1:end-1)) + 1, shift3_idx);
shift2_data = t(shift2_idx,:);
shift1_idx = setdiff((1:height(t)).',union(shift2_idx,shift3_idx));
shift1_data = t(shift1_idx, :);