Home > src > setBufferedHistoryOutfile_Dialog.m

# setBufferedHistoryOutfile_Dialog

## PURPOSE

- dialog for setting output file for buffered history output

## SYNOPSIS

function varargout = setBufferedHistoryOutfile_Dialog(varargin)

## DESCRIPTION

     - dialog for setting output file for buffered history output

     copyright 2009-2012 Blair Armstrong, Christine Watson, David Plaut

        This file is part of SOS

        SOS is free software: you can redistribute it and/or modify
        it for academic and non-commercial purposes
        under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.  For commercial or for-profit
        uses, please contact the authors (sos@cnbc.cmu.edu).

        SOS is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

## CROSS-REFERENCE INFORMATION

This function calls:

- getdfName - extracts a dataframe name selected in the GUI
- sos_gui - sos main GUI
- verbosePrint - master print function that regulates cmd line output based on verbosity flags

This function is called by:

- sos_gui - sos main GUI

## SUBFUNCTIONS

- function setBufferedHistoryOutfile_Dialog_OpeningFcn(hObject, eventdata, handles, varargin)
- function varargout = setBufferedHistoryOutfile_Dialog_OutputFcn(hObject, eventdata, handles)
- function pushbutton_setHistoryOutFile_Callback(hObject, eventdata, handles)
- function pushbutton_setBufferedHistoryOutfile_Callback(hObject, eventdata, handles)

## SOURCE CODE

    0001 % - dialog for setting output file for buffered history output
    0002 %
    0003 % copyright 2009-2012 Blair Armstrong, Christine Watson, David Plaut
    0004 %
    0005 %    This file is part of SOS
    0006 %
    0007 %    SOS is free software: you can redistribute it and/or modify
    0008 %    it for academic and non-commercial purposes
    0009 %    under the terms of the GNU General Public License as published by
    0010 %    the Free Software Foundation, either version 3 of the License, or
    0011 %    (at your option) any later version.  For commercial or for-profit
    0012 %    uses, please contact the authors (sos@cnbc.cmu.edu).
    0013 %
    0014 %    SOS is distributed in the hope that it will be useful,
    0015 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
    0016 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0017 %    GNU General Public License for more details.
    0018
    0019 %    You should have received a copy of the GNU General Public License
    0020 %    along with SOS (see COPYING.txt).
    0021 %    If not, see <http://www.gnu.org/licenses/>.
    0022
    0023
    0024
    0025 function varargout = setBufferedHistoryOutfile_Dialog(varargin)
    0026 % SETBUFFEREDHISTORYOUTFILE_DIALOG M-file for setBufferedHistoryOutfile_Dialog.fig
    0027 %      SETBUFFEREDHISTORYOUTFILE_DIALOG, by itself, creates a new SETBUFFEREDHISTORYOUTFILE_DIALOG or raises the existing
    0028 %      singleton*.
    0029 %
    0030 %      H = SETBUFFEREDHISTORYOUTFILE_DIALOG returns the handle to a new SETBUFFEREDHISTORYOUTFILE_DIALOG or the handle to
    0031 %      the existing singleton*.
    0032 %
    0033 %      SETBUFFEREDHISTORYOUTFILE_DIALOG('CALLBACK',hObject,eventData,handles,...) calls the local
    0034 %      function named CALLBACK in SETBUFFEREDHISTORYOUTFILE_DIALOG.M with the given input arguments.
    0035 %
    0036 %      SETBUFFEREDHISTORYOUTFILE_DIALOG('Property','Value',...) creates a new SETBUFFEREDHISTORYOUTFILE_DIALOG or raises the
    0037 %      existing singleton*.  Starting from the left, property value pairs are
    0038 %      applied to the GUI before setBufferedHistoryOutfile_Dialog_OpeningFcn gets called.  An
    0039 %      unrecognized property name or invalid value makes property application
    0040 %      stop.  All inputs are passed to setBufferedHistoryOutfile_Dialog_OpeningFcn via varargin.
    0041 %
    0042 %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    0043 %      instance to run (singleton)".
    0044 %
    0045 % See also: GUIDE, GUIDATA, GUIHANDLES
    0046
    0047 % Edit the above text to modify the response to help setBufferedHistoryOutfile_Dialog
    0048
    0049 % Last Modified by GUIDE v2.5 09-Sep-2010 19:38:38
    0050
    0051 % Begin initialization code - DO NOT EDIT
    0052 gui_Singleton = 1;
    0053 gui_State = struct('gui_Name',       mfilename, ...
    0054                    'gui_Singleton',  gui_Singleton, ...
    0055                    'gui_OpeningFcn', @setBufferedHistoryOutfile_Dialog_OpeningFcn, ...
    0056                    'gui_OutputFcn',  @setBufferedHistoryOutfile_Dialog_OutputFcn, ...
    0057                    'gui_LayoutFcn',  [] , ...
    0058                    'gui_Callback',   []);
    0059 if nargin && ischar(varargin{1})
    0060     gui_State.gui_Callback = str2func(varargin{1});
    0061 end
    0062
    0063 if nargout
    0064     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    0065 else
    0066     gui_mainfcn(gui_State, varargin{:});
    0067 end
    0068 % End initialization code - DO NOT EDIT
    0069
    0070
    0071 % --- Executes just before setBufferedHistoryOutfile_Dialog is made visible.
    0072 function setBufferedHistoryOutfile_Dialog_OpeningFcn(hObject, eventdata, handles, varargin)
    0073 % This function has no output args, see OutputFcn.
    0074 % hObject    handle to figure
    0075 % eventdata  reserved - to be defined in a future version of MATLAB
    0076 % handles    structure with handles and user data (see GUIDATA)
    0077 % varargin   command line arguments to setBufferedHistoryOutfile_Dialog (see VARARGIN)
    0078
    0079 % Choose default command line output for setBufferedHistoryOutfile_Dialog
    0080 handles.output = hObject;
    0081
    0082 % Update handles structure
    0083 guidata(hObject, handles);
    0084
    0085 % UIWAIT makes setBufferedHistoryOutfile_Dialog wait for user response (see UIRESUME)
    0086 % uiwait(handles.figure_setBufferedHistoryOutfile);
    0087
    0088
    0089 % --- Outputs from this function are returned to the command line.
    0090 function varargout = setBufferedHistoryOutfile_Dialog_OutputFcn(hObject, eventdata, handles)
    0091 % varargout  cell array for returning output args (see VARARGOUT);
    0092 % hObject    handle to figure
    0093 % eventdata  reserved - to be defined in a future version of MATLAB
    0094 % handles    structure with handles and user data (see GUIDATA)
    0095
    0096 % Get default command line output from handles structure
    0097 varargout{1} = handles.output;
    0098
    0099
    0100 % --- Executes on button press in pushbutton_setHistoryOutFile.
    0101 function pushbutton_setHistoryOutFile_Callback(hObject, eventdata, handles)
    0102 % hObject    handle to pushbutton_setHistoryOutFile (see GCBO)
    0103 % eventdata  reserved - to be defined in a future version of MATLAB
    0104 % handles    structure with handles and user data (see GUIDATA)
    0105
    0106     [fileName,pathName] = uiputfile('*','Save history as...');
    0107
    0108     % check to make sure user didn't cancel (which cases fileName == 0)
    0109     if fileName ~= 0
    0110         fullName = strcat(pathName,fileName);
    0111
    0112         set(handles.text_historyOutFile,'String',fullName);
    0113     end
    0114
    0115
    0116 % --- Executes on button press in pushbutton_setBufferedHistoryOutfile.
    0117 function pushbutton_setBufferedHistoryOutfile_Callback(hObject, eventdata, handles)
    0118 % hObject    handle to pushbutton_setBufferedHistoryOutfile (see GCBO)
    0119 % eventdata  reserved - to be defined in a future version of MATLAB
    0120 % handles    structure with handles and user data (see GUIDATA)
    0121     outFile = get(handles.text_historyOutFile,'String');
    0122
    0123     write = true;
    0124
    0125     % don't write if no file specified;
    0126     if isempty(outFile)
    0127         write = false;
    0128         msgbox('A valid file must be specified','Write error');
    0129
    0130     end
    0131
    0132     if write == true
    0133         mainWindowHandle = sos_gui;
    0134         mainWindowData = guidata(mainWindowHandle);
    0135
    0136         sosObjName = getdfName(mainWindowData.popupmenu_SOSSelector,'SOS');
    0137
    0138         if isempty(sosObjName) == 0
    0139             % write the file
    0140              command = [sosObjName,'.setBufferedHistoryOutfile(''',outFile,''');'];
    0141
    0142             verbosePrint(['Executing command: ','''',command,''''],'setBufferedHistoryOutfile_Dialog_create');
    0143             evalin('base',command);
    0144
    0145             close(handles.figure_setBufferedHistoryOutfile);
    0146         else
    0147             % no need to do anything, all methods called generate errors if
    0148             % they contain invalid fields.
    0149         end
    0150     end
    0151