Ugh.... figured it out.... Leaving up for full disclosure instead of deleting the post:
The fix is as follows:
%%
t1 = (datetime('2020-06-30 23:45:00') : -minutes(15) : datetime('2020-06-28 00:00:00')).';
t1.Format = 'yyyy-MM-dd HH:mm:ss';
t2 = t1;
t2(2) = []; %forcing a missing value in order to create a loop to re-insert the now missing value.
%note: t1 is the reference vector with no missing values, t2 is the dataset with impurities
k = 0;
for i = 1:length(t2)
if t2(i) ~= t1(i)
counter = i;
k = k+1;
log(k) = i; %to maintain a log of every missing datetime value.
%need to insert missing element
temp(k) = t1(i);
t2 = [t2(1:i-1); temp(k); t2(i:end)];
end
end
The issue is here:
t2 = [t2(1:i-1); temp(k); t2(i:end)];
in my OP, the code was written as:
t2 = [t2(1:i-1), temp(k), t2(i:end)];
where in that last line it was trying to created a (1xN) vector but each individual component is in the form (Nx1).... I initially thought it was something funky going on with the datetime datatype...
amateur mistake over here I guess. Took me an embarassing 1.5 hours to find that.