function output problem



Hi everyone,

I have defined a function with two output arguments. however, when I
run the function, it always only gives the first argument as the final
answer. I don't know what happen. Hope you can help me with this.

function [vector,eigens] = Sr(n,x)
% CSD - Schur decomposition of the Cross spectrum
% x - Angular frequency
% n - spatial points
for i = 1:n
for j = 1:n
CSM(i,j) = S(x)*Coh(x)^abs(i-j);
end
end
[vector,eigens]=schur(CSM);

it gives the answer:
ans =

-0.4990 -0.7071 0.5010
0.7085 -0.0000 0.7057
-0.4990 0.7071 0.5010
which is only the eigenvectors

If I do not hide the result of the final line, it gives:
vector =

-0.4990 -0.7071 0.5010
0.7085 -0.0000 0.7057
-0.4990 0.7071 0.5010


eigens =

0.1883 0 0
0 0.1913 0
0 0 0.1943


ans =

-0.4990 -0.7071 0.5010
0.7085 -0.0000 0.7057
-0.4990 0.7071 0.5010

.



Relevant Pages