Code covered by the BSD License  

Highlights from
CTMSIM - an interactive freeway traffic macrosimulator

image thumbnail
from CTMSIM - an interactive freeway traffic macrosimulator by Alex Kurzhanskiy
Freeway traffic simulation based on Asymmetric Cell Transmission Model

fwcfgGUIclose()
function fwcfgGUIclose()
% FRPGUICLOSE - saves data if necessary, performs cleanup and closes 'fwcfgGUI' window;
%               this function neither takes nor returns any parameters.
%
% Last modified:   11/17/2006.

%
% Alex Kurzhanskiy   <akurzhan@eecs.berkeley.edu>
%

global g_fwcfg;

if g_fwcfg.isBusy
  beep;
  return;
end

if ~g_fwcfg.isSaved
  currFig  = get(0, 'CurrentFigure');
  pos_size = get(currFig, 'Position');
  res      = save_dialog([pos_size(1)+pos_size(3)/2.5 pos_size(2)+pos_size(4)/2.5], 'Save configuration?');
  if res == 1  % save configuration
    fn = uiputfile('*.mat');
    if ~isa(fn, 'double')
      save_config(g_fwcfg, fn);
    end
  elseif res == 2
    return;
  end
end

% clean up
clear global g_fwcfg;

% close GUI
shh     = get(0, 'ShowHiddenHandles');
set(0, 'ShowHiddenHandles', 'on');
currFig = get(0, 'CurrentFigure');
set(0, 'ShowHiddenHandles', shh);
delete(currFig);


return;

Contact us at files@mathworks.com