% GUIoutputdata
% Function for the MODIS GUI
% Copyright by Jasmine S Nahorniak, Oregon State University.
% Feb 25 2000

function GUIoutputdata(data);

GUIbutton('Pushbutton5','WORKING','on');

GUIdefaults;

% find name of input data file
infiles=get(findobj('Tag','Listbox1'),'String');
choice=get(findobj('Tag','Listbox1'),'Value');
cellfile=infiles(choice,:);
classfile=class(cellfile);
if classfile(1:4)=='char'
  infile=cellfile;
else
  infile=cat(1,cellfile{:});  % convert to string
end

% remove any blanks in the infile string
blanks=find(infile==' ' | infile==':');
infile(blanks)='_';

% get chosen data
outdata=data{choice};

% get output data file name
[outfile,outpath]=uiputfile([guioutpath infile '.dat'],'Save as:');

if outfile~=0,    % cancel button not hit
  eval(['save ''' outpath outfile ''' outdata -ascii']);
end

GUIbutton('Pushbutton5','output data','off');
