MATLAB: Does casting in MATLAB 6.1 (R12.1) sometimes return a complex variable with a zero imaginary part

castcompleximaginaryMATLABr12.1pv1_swatrealuint8zero

Why does casting in MATLAB 6.1 (R12.1) sometimes return a complex variable with a zero imaginary part?
The casting call UINT8(2 – i) returns a complex result with a zero imaginary part, but it seems that a real result should be obtained instead.

Best Answer

This bug has been fixed for Release 14 (R14). For previous releases, please read below for any possible workarounds:
This has been verified as a bug in MATLAB 6.1 (R12.1) in the way that UINT8(2 - i) is handled.
There are currently no known workarounds.