function varargout = valffdoe(varargin)
% VALFFDOE M-file for valffdoe.fig
% VALFFDOE, by itself, creates a new VALFFDOE or raises the existing
% singleton*.
%
% H = VALFFDOE returns the handle to a new VALFFDOE or the handle to
% the existing singleton*.
%
% VALFFDOE('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in VALFFDOE.M with the given input arguments.
%
% VALFFDOE('Property','Value',...) creates a new VALFFDOE or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before valffdoe_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to valffdoe_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help valffdoe
% Last Modified by GUIDE v2.5 16-Feb-2006 11:47:09
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @valffdoe_OpeningFcn, ...
'gui_OutputFcn', @valffdoe_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
function valffdoe_OpeningFcn(hObject, eventdata, handles, varargin)
%%***********************************************************************
%% Method: valffdoe_OpeningFcn
%% Purpose: Initializes variables to be used by valffdoe.
%% Parameters:
%% hObject: handle to quit (see GCBO)
%% eventdata: reserved - to be defined in a future version of MATLAB
%% handles: structure with handles and user data (see GUIDATA)
%% varargin: command line arguments to valffdoe (see VARARGIN)
%% Returns: none
%%***********************************************************************
%Choose default command line output for valffdoe
handles.output = hObject;
%Initialize global variables.
handles.testvarnamearray=[]; %Stores names of variables
handles.testvararray=[]; %Stores variable data
handles.testarray=[]; %Stores test points
%Save globals.
guidata(hObject, handles);
function varargout = valffdoe_OutputFcn(hObject, eventdata, handles)
%%***********************************************************************
%% Method: valffdoe_OutputFcn
%% Purpose: Directs the output for the GUI.
%% Parameters:
%% hObject: handle to quit (see GCBO)
%% eventdata: reserved - to be defined in a future version of MATLAB
%% handles: structure with handles and user data (see GUIDATA)
%% Returns:
%% varargout: cell array for returning output args (see VARARGOUT)
%%***********************************************************************
% Get default command line output from handles structure
varargout{1} = handles.output;
function createarray_Callback(hObject, eventdata, handles)
%%***********************************************************************
%% Method: createarray_Callback
%% Purpose: Allows the user to create the test array when the Create Array
%% button is pressed.
%% Parameters:
%% hObject: handle to quit (see GCBO)
%% eventdata: reserved - to be defined in a future version of MATLAB
%% handles: structure with handles and user data (see GUIDATA)
%% Returns: none
%%***********************************************************************
%Create the test array.
handles.testarray = createvalarray(handles.testvararray,1);
if get(handles.randomize,'Value') == 1
%If the user requests a randomized array, shuffle the array.
handles.testarray=shuffle(handles.testarray,1);
end
%Send data back to autocal application.
setappdata(0,'testarray',handles.testarray)
setappdata(0,'testvarnamearray',handles.testvarnamearray)
setappdata(0,'testvararray',handles.testvararray)
setappdata(0,'status','ok');
%Save globals.
guidata(hObject, handles);
%Close the application.
close;
function cancel_Callback(hObject, eventdata, handles)
%%***********************************************************************
%% Method: cancel_Callback
%% Purpose: Allows the user to close the application when the Cancel
%% button is pressed, discarding changes.
%% Parameters:
%% hObject: handle to quit (see GCBO)
%% eventdata: reserved - to be defined in a future version of MATLAB
%% handles: structure with handles and user data (see GUIDATA)
%% Returns: none
%%***********************************************************************
%Send data back to autocal application.
setappdata(0,'status','cancel');
%Close the application.
close;
function var_list_Callback(hObject, eventdata, handles)
%%***********************************************************************
%% Method: var_list_Callback
%% Purpose: Executes on selection change in var_list.
%% Parameters:
%% hObject: handle to quit (see GCBO)
%% eventdata: reserved - to be defined in a future version of MATLAB
%% handles: structure with handles and user data (see GUIDATA)
%% Returns: none
%%***********************************************************************
%This function does nothing.
function var_list_CreateFcn(hObject, eventdata, handles)
%%***********************************************************************
%% Method: var_list_CreateFcn
%% Purpose: Executes during the creation of var_list.
%% Parameters:
%% hObject: handle to quit (see GCBO)
%% eventdata: reserved - to be defined in a future version of MATLAB
%% handles: structure with handles and user data (see GUIDATA)
%% Returns: none
%%***********************************************************************
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function add_var_Callback(hObject, eventdata, handles)
%%***********************************************************************
%% Method: add_var_Callback
%% Purpose: Allows the user to add a DOE variable when the Add Variable
%% button is pressed.
%% Parameters:
%% hObject: handle to quit (see GCBO)
%% eventdata: reserved - to be defined in a future version of MATLAB
%% handles: structure with handles and user data (see GUIDATA)
%% Returns: none
%%***********************************************************************
%Prompt the user for variable information, and retrieve this data.
input=inputdlg({'Variable Name','Values (Place space between each value)'},'Add a DOE Variable');
%As long as OK was pressed, proceed.
if length(input)>0
%As long as proper inputs were provided, proceed.
if length(input{1})>0 && length(input{2})>0
varname=input{1};
values=(input{2});
%Add the variable name to the database.
handles.testvarnamearray=[handles.testvarnamearray;{varname}];
%Separate the individual values for the DOE variable, and add them to
%the database.
numvalues=explode(values,' ');
handles.testvararray=[handles.testvararray;{numvalues}];
%Retrieve the current listing of DOE values from the GUI.
currentlisting = get(handles.var_list,'String');
%Add the new variable to the listing, and update the GUI.
vardisplay = strcat([varname,' Values:',num2str(values)]);
currentlisting = [currentlisting;{vardisplay}];
set(handles.var_list,'String',currentlisting);
%Enable the Create Array button and Remove Variable button.
set(handles.createarray,'Enable','on');
set(handles.remove_var,'Enable','on');
%Save globals.
guidata(hObject, handles);
end
end
function remove_var_Callback(hObject, eventdata, handles)
%%***********************************************************************
%% Method: remove_var_Callback
%% Purpose: Allows the user to remove a DOE variable when the Remove
%% Variable button is pressed.
%% Parameters:
%% hObject: handle to quit (see GCBO)
%% eventdata: reserved - to be defined in a future version of MATLAB
%% handles: structure with handles and user data (see GUIDATA)
%% Returns: none
%%***********************************************************************
%Retrieve the current listing of DOE variables from the GUI.
currentlisting = get(handles.var_list,'String');
%Determine which variable is selected within the list.
index = get(handles.var_list,'Value');
if length(currentlisting)>0
%Remove the variable from all databases.
currentlisting = [currentlisting(1:index-1,:);currentlisting(index+1:length(currentlisting(:,1)),:)];
handles.testvarnamearray=[handles.testvarnamearray(1:index-1,:);handles.testvarnamearray(index+1:length(handles.testvarnamearray(:,1)),:)];
handles.testvararray=[handles.testvararray(1:index-1,:);handles.testvararray(index+1:length(handles.testvararray(:,1)),:)];
%Update the GUI with the remaining variable names.
set(handles.var_list,'Value',1);
set(handles.var_list,'String',currentlisting);
end
%Retrieve the new listing in the GUI.
currentlisting = get(handles.var_list,'String');
%If there are no variables left, make the options to remove variables
%and create the test array unavailable.
if length(currentlisting)==0
set(handles.remove_var,'Enable','off');
set(handles.createarray,'Enable','off');
end
%Save globals.
guidata(hObject, handles);
function randomize_Callback(hObject, eventdata, handles)
%%***********************************************************************
%% Method: randomize_Callback
%% Purpose: Executes when randomize is pressed
%% Parameters:
%% hObject: handle to quit (see GCBO)
%% eventdata: reserved - to be defined in a future version of MATLAB
%% handles: structure with handles and user data (see GUIDATA)
%% Returns: none
%%***********************************************************************
%This function does nothing.