The error message should also tell you what line Tmax appears on, and if you are calling external functions, the function it appears in. Go to that line to see what your code is doing there.
Also, in the MATLAB Editor, in the Navigate section of the top toolstrip, click on Find, then search on Tmax. That will allow you to see where it is. You can then take whatever action is appropriate.