hours(diff(datetime(t1;t2]))) = c
You're using hours that is a builtin function as an array name on the LHS of an assignment statement and you also have an unmatched "]" bracket in the expression.
You also don't need a loop here...use MATLAB vectorized operations instead...
You don't provide what y variable contains; presuming it can be converted to a datetime, then if the answer is to determine how many of the time differences between the two columns are > 3 hours, then
This presumes as your code that the first date is in the second column not the first -- one would normally think that would be the other way 'round; in which case would want to reverse the column indices in the difference calculation.