Otherwise, MATLAB  throws an error. typecast is different from the MATLAB cast function in that it does not alter the input data. typecast always returns the same number of bytes in the output Y as in the input X.