legend_callback.m
上传用户:jspk663
上传日期:2013-08-19
资源大小:232k
文件大小:1k
- function legend_callback
- try
- T=findobj(gcf,'tag','compo1');
- co=get(T,'userdata');
- s=num2str(co(1));
- catch
- return
- end
- s=['''',s,''''];
- for i=2:length(co)
- s=[s,',','''',num2str(co(i)),''''];
- end
-
- try
- L=findobj(gcf,'tag','legendh');%%%%
- switch get(L,'userdata') %
- case 1, %
- set(L,'userdata',0); %naming legendh to avoid collision with eval...
- legend off %
- case 0, %
- eval(['legend(',s,')']);%%%%%%%%
- set(L,'userdata',1);
- end
- catch
- return
- end