You have to go back to MATLAB R13 or at most R14SP1 to find information on specgram(), which was considered to be obsoleted as of R14SP2 (that is, it had already been declared old even before that, and R14SP2 was to be the release that finally got rid of it.)
There we find,
"t is a column vector of scaled times, with length equal to the number of columns of B"
I am not sure at the moment how the number of columns of B is calculated, but some tests suggest that the boundary might be that the second parameter to spectgram() might have to exceed 2/3 the length of the input signal for there to be only one column of output. In the case of only one input to specgram(), such as you have, the boundary appears to be that the length of the input must be 383 or less.
After that, the B output of specgram() would have multiple columns, leading to multiple rows in the t output, which gives you problems when you try to build [1 fs 1 T ]
Perhaps you should try [1 fs 1 max(T) ]