Consider the following minimal example:
function CoderEigFail() %#codegen
A = [0 sqrt(2); sqrt(2) 0];
[B C] = eig(A)
When I compile this via codegen CoderEigFail.m
and run it, I get a different matrix B than I get when I run the original Matlab file instead. In particular, for the mex file I get B = [1 1; -1 1], while for the Matlab file I get B = [-0.7071 0.7071; 0.7071 0.7071]. I have Matlab R2011a running on MacOSx Mountain Lion.
Can anyone reproduce/explain this behavior? Is this a bug or am I missing something here?