forked from MBB-team/VBA-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VBA_pause.m
51 lines (47 loc) · 1.56 KB
/
VBA_pause.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function [] = VBA_pause(options)
% used to pause the VB inversion from the GUI interactively
% NB: when paused, the inversion allows interactive diagnosis...
try
dt = toc(options.tStart);
if floor(dt./60) == 0
timeString = [num2str(floor(dt)),' sec'];
else
timeString = [num2str(floor(dt./60)),' min'];
end
set(options.display.htt,'string',['Elapsed time: ',timeString])
end
try
hpause = options.display.hpause;
if ~isempty(hpause) && ishandle(hpause)
if get(hpause,'value')
set(hpause,'string','PAUSED!',...
'backgroundColor',[1 0.5 0.5])
stop = 0;
try
[posterior,out] = evalin(...
'caller',...
'VBA_wrapup(posterior,options,options.dim,suffStat,suffStat.u,y,it,1)');
catch
[posterior,out] = evalin(...
'caller',...
'VBA_wrapup(posterior,options,options.dim,suffStat,u,y,it,1)');
end
hfp = VBA_ReDisplay(posterior,out,1,1);
s = dbstatus;
if isempty(s)
dbstop if error % this allows to have a look...
end
while ~stop
pause(2)
if ~get(hpause,'value')
stop = 1;
set(hpause,'string','pause and diagnose?',...
'backgroundColor',0.8*[1 1 1])
try
close(hfp)
end
end
end
end
end
end