It turns out that h
is an array of handles, since there are multiple objects in this figure.
Thus, the manipulations must be performed in each entry in the array h
separately.
e.g.
ydata = get(h(1), 'YData');
% do stuff to ydata,
set(h(1), 'YData', ydata);
ydata = get(h(2), 'YData');
% do stuff to ydata,
set(h(2), 'YData', ydata);