Code covered by the BSD License

### Highlights fromNumerical Computing with Simulink, Vol. 1

from Numerical Computing with Simulink, Vol. 1 by Richard Gran
This sequel to Numerical Computing with MATLAB explores the mathematics of simulation.

updatetime(Clock)
```function updatetime(Clock)
persistent AMPM Clocksec Clockmin Clockhr changehr changemin changeampm

if Clock == 0; return; end

hGUI     = evalin('base','hGUI');
h        = guidata(hGUI);
Hrfield  = get(h.text15,'String');

if strcmp(Hrfield,'00')
AMPM      = 'am';
Clocksec  = 0;
Clockmin  = 0;
Clockhr   = 12;
changemin = 1;
changehr  = 1;
changeampm= 1;
end

Clocksec = Clocksec + 1;
if Clocksec == 60
Cm = get(h.text13,'String');
Clockmin = str2double(Cm);
Clocksec = 0;
Clockmin = Clockmin + 1;
changemin = 1;
if Clockmin == 60
Ch = get(h.text15,'String');
Clockhr   = str2double(Ch);
Clockhr   = Clockhr + 1;
Clockmin  = 0;
changehr  = 1;
if Clockhr == 13; Clockhr = 1; end
if Clockhr == 12 && Clockmin == 0
changeampm = 1;
if strcmp(AMPM,'am')
AMPM = 'pm';
else
AMPM = 'am';
end
end
end
end

if changemin == 1;
Clockmins = num2str(Clockmin);
if Clockmin < 10; Clockmins = ['0' Clockmins]; end
set(h.text13,'String',Clockmins)
changemin = 0;
end
if changehr == 1;
Clockhrs = num2str(Clockhr);
set(h.text15,'String',Clockhrs)
changehr = 0;
end
if changeampm == 1;
set(h.text11,'String',AMPM)
changeampm = 0;
end```