h = findobj(gca, 'Type', 'line');
x1 = get(h(1), 'XData')
y1 = get(h(1), 'YData')
x2 = get(h(2), 'XData')
y2 = get(h(2), 'YData')
But actually your code should work already. If h contains 2 line handles (does it?), then
h = findobj(gca, 'Type', 'line');
x = get(h, 'XData')
replies a {2 x 1} cell. Now x{1} contains the XData of the first line, x{2} of the 2nd line - and the same for the YData. Therefore I cannot reconsider why you state, that you "get the data points of imag(neff)" only. Why do you think that this is the fact?
[EDITED] Ah, this is not one axes object, but two created by plotyy or yyaxis. Then you do not need gca only, but all line objects:
h = findobj(gcf, 'Type', 'line')
You have to search in the current figure, not in the active axes only. Then your code will work.
By the way: Did you use the debugger to check, what your "h = findobj(gca,'Type','line')" replies?
Best Answer