%% Wait for Timeout
% Close a figure after a specified timeout duration has elapsed.
% Create a line plot in a figure.

fig = uifigure;
fig.Position = [500 500 500 350];
ax = uiaxes(fig);
plot(ax,1:10)

% Create a five-second timeout and then close the figure.

uiwait(fig,5)

try 
close(fig)
catch
end

% Copyright 2019 The MathWorks, Inc.