From: Jan Simon on
Dear readers!

Can somebody explain this behaviour of ANCESTOR or is it a bug?

Works as expected:
a = line; b = line; % 2 dummy objects
P = ancestor([a,b], 'figure')
> P = {1; 1} % ok

Unexpected, at least for me:
P = ancestor([a, 123], 'figure') % Arbitrary non-handle
> P = [1] % ??? Expected: P = {1; []}
P = ancestor([a, 123, b], 'figure')
> P = {1; 1} % ??? Expected: P = {1; []; 1}
P = ancestor([a, -1], 'figure')
> P = [] % ??? Expected: P = {1; []}

The documentation states:
"If H is not an Handle Graphics object, ANCESTOR returns empty."
"If H is a vector of handles then P is a cell array the same length as H and P{n} is the ancestor of H(n)."

1. With the found behaviour, the reply of ANCESTOR is nearly not usable if an element of the input H vector is not an Handle Graphics object.
2. Why is the reply different for a not existing handle and an invalid handle as -1 ?

I wanted to ask before I send a bug report.
Thanks, Jan
From: Bruno Luong on
Until an authority pronounces, to me it looks like a bug.

Jan, you are probably one of the rarest persons who use ANCESTOR on a population.

Bruno
From: Jan Simon on
Dear Bruno!

> Until an authority pronounces, to me it looks like a bug.
>
> Jan, you are probably one of the rarest persons who use ANCESTOR on a population.

I have to program compatible with Matlab 6.5 and needed an M-file simulating ANCESTOR for this old version. While the implementation was straight following the help text, the automatical unit-test failed.
I have the impression, that TMW did not control the quality of ANCESTOR with a unit-test. I really hope, this is an exception.

Thanks, Bruno! I'll send the report.
Jan