MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Guide de l'utilisateur Page 484

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 759
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 483
10 Examples of GUIDE GUIs
startbtn_Callback
startbtn_Callback calls timer start m ethod if the timer is not already
running:
if strcmp(get(h andl es.timer, 'Running' ), 'off')
start(handles.timer);
end
stopbtn_Callback
stopbtn_Callback calls the timer stop method if the timer is currently
running:
if strcmp(get(h andl es.timer, 'Running' ), 'on')
stop(handles.timer);
end
periodsldr_Callback
periodsldr_Callback is called each time you move the slider. It sets timer
period to the slider current value after removing unwanted precision:
% Read the slider value
period = get(handles.periodsldr ,'Value');
% Timers need the precision of periods to be greater than about
% 1 millisecond, so truncat e the value returne d by the slider
period = period - mod(perio d,.01);
% Set slider readout to sho w its value
set(handles.slidervalue,'String',nu m2str(period))
% If timer is on, stop it, reset the peri od, and start it again.
if strcmp(ge t(ha ndles.timer, 'Runni ng') , 'on')
stop(handles.timer);
set(handles.timer,'Period',period)
start(handles.timer)
else % If timer is stopped, reset its period only.
set(handles.timer,'Period',period)
end
The slider callback must stop the tim er to reset its period, because timer
objects do not allow their periods to vary while they are running.
10-110
Vue de la page 483
1 2 ... 479 480 481 482 483 484 485 486 487 488 489 ... 758 759

Commentaires sur ces manuels

Pas de commentaire