Code covered by the BSD License  

Highlights from
Soft interrupting of long computer runs

Soft interrupting of long computer runs

by

 

Long run of the program can be interrupted without any loss of data in a workspace.

setbutton(x,y)
function h = setbutton(x,y)
%   SETBUTTON    Create pushbutton figure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The function setbutton is a slight modification of Roni Peer's function
% createbutton (http://www.mathworks.com/matlabcentral/fileexchange/35114).
% It creates a small figure window in a user's defined place on screen.
% Pushing the button by a mouse sets the global variable FLAG, which is
% recognized by the function interpt.m

% Miroslav Balda 
% miroslav AT balda
% 2012-02-22    v.1.0   basic version

global FLAG

h = figure;
set(h,'MenuBar','none','Units','Normalized');
set(h,'Position',[x y 0.035 0.035]);

%hUpdateButton = uicontrol(...       %   Button for updating selected plot
uicontrol(...       %   Button for updating selected plot
    'Parent', h, ...
    'Units','normalized',...
    'HandleVisibility','callback', ...
    'Position',[0.05 0.05 0.9 0.9],...
    'FontName','Ariel', 'FontSize',12, 'FontWeight','bold',...
    'String','BREAK',...
    'BackgroundColor',[1 0.6 0.6],...
    'Callback', 'evalin(''base'',''FLAG=true;'')');

Contact us