www.pudn.com > Kalman_matlab00000.rar > legend_callback.m, change:2003-10-30,size:613b


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