% get the figure handle
h = figure(1) % or whatever fig
% get the axes handle
a = get(h, 'CurrentAxes')
% get the handles for children of the axes -- these are the data series handles
c = get(a, 'Children')
% generate a legend command using these "children"
legend(c([1 3 5]), 'label for data 1', 'label for 3', 'label for 5')
댓글 없음:
댓글 쓰기