function mcs_save_run(mcs_root)
%
% Copies MCS box information so that same information from a given run
% can be loaded back in later.
%
%
% COPYRIGHT (c) 2008
% 
% Applied Research Laboratories, The University of Texas at Austin
% (ARL:UT)
% All rights reserved.
% 
% This material may be reproduced by or for the U.S. Government
% only. This notice must appear in all copies of this file and its
% derivatives. Further distribution outside the U.S. Government is
% prohibited without the explicit written authorization from the
% Director of the Environmental Sciences Laboratory, ARL:UT.
% 
% THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
% EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE
% IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
% PURPOSE, OR NONINFRINGEMENT.
% 
% IN NO EVENT WILL ARL:UT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING
% OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN IF ARL:UT HAS
% BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
mcs_global
%
if nargin<1, mcs_root=MCS.out_root; end
%
if isempty(mcs_root),
	disp('NOTE: To save parameters in _mcs.mat file for future runs, enter output file root.');
	return
end
%
nboxtot=MBOX.nboxtot; 
HBOX.nboxtot=nboxtot;
HBOX.string=cell(nboxtot,1);
HBOX.value=zeros(nboxtot,1);
HBOX.tag=cell(nboxtot,1);
%
for jbox=1:nboxtot,
	h1=MBOX.handle(1,jbox);
	HBOX.string{jbox}=get(h1,'String');
	hval=get(h1,'Value');
	HBOX.value(jbox)=hval(1);
	HBOX.tag{jbox}=get(h1,'Tag');
end
%
% Save structures to _gui.mat file:
gui_file=[mcs_root,'_mcs'];
str=['save ',gui_file,' MCS HBOX']; 
eval(str);
% Also save file containing name of last _gui.mat file produced:
save mcs_def mcs_root
