from
MakeWhole
by David Cumin
Takes a triangular matrix and fills in the other half.
|
| makeWhole(in)
|
function out = makeWhole(in)
%%%Takes a triangular matrix and fills in the other half
%%%e.g. half = triu(magic(5));
%%% all = makeWhole(half);
%%%or half = tril(magic(5));
%%% all = makeWhole(half);
if(sum(sum(triu(in,1))) > 0)
out = in + triu(in,1)';
else
out = in + tril(in,-1)';
end
end%%%function
|
|
Contact us at files@mathworks.com