No BSD License  

Highlights from
INCA Matlab Auto Calibration Wizard

image thumbnail

INCA Matlab Auto Calibration Wizard

by

 

27 Sep 2007 (Updated )

This is a Matlab application which accesses the INCA API and guides users through the process of aut

intffdoe(varargin)
function varargout = intffdoe(varargin)
% INTFFDOE M-file for intffdoe.fig
%      INTFFDOE, by itself, creates a new INTFFDOE or raises the existing
%      singleton*.
%
%      H = INTFFDOE returns the handle to a new INTFFDOE or the handle to
%      the existing singleton*.
%
%      INTFFDOE('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in INTFFDOE.M with the given input arguments.
%
%      INTFFDOE('Property','Value',...) creates a new INTFFDOE or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before intffdoe_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to intffdoe_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 intffdoe

% Last Modified by GUIDE v2.5 16-Feb-2006 11:54:31

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @intffdoe_OpeningFcn, ...
                   'gui_OutputFcn',  @intffdoe_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 intffdoe_OpeningFcn(hObject, eventdata, handles, varargin)
%%***********************************************************************
%%	Method: intffdoe_OpeningFcn
%%	Purpose: Initializes variables to be used by intffdoe.
%%	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 intffdoe (see VARARGIN)
%%	Returns: none
%%***********************************************************************
    %Choose default command line output for intffdoe
    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 = intffdoe_OutputFcn(hObject, eventdata, handles) 
%%***********************************************************************
%%	Method: intffdoe_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 = createintarray(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 the 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 object creation, after setting all properties.
%%	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','Minimum Value','Maximum Value','Interval of Change'},'Add a DOE Variable');
    %As long as OK was pressed, proceed.
    if length(input)>0
        %If the inputs are provided in a correct format, proceed.
        if length(input{1})>0 && length(input{2})>0 && length(input{3})>0 && length(input{4})>0
            varname=input{1};
            varmin=str2num(input{2});
            varmax=str2num(input{3});
            varint=str2num(input{4});

            %Add the variable name to the database.
            handles.testvarnamearray=[handles.testvarnamearray;{varname}];

            %Add the variable data to the database.
            handles.testvararray=[handles.testvararray;varmin,varmax,varint];

            %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,'   Min:',num2str(varmin),'   Max:',num2str(varmax),'   Interval:',num2str(varint)]);
            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');
    
    %Remove the variable from all databases.
    if length(currentlisting)>0
        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 from the GUI.
    currentlisting = get(handles.var_list,'String');
    
    %If it is empty, turn off the options to remove a variable or create a
    %test array.
    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 on button press in randomize.
%%	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.

Contact us