Code covered by the BSD License  

Highlights from
Numerical Computing with Simulink, Vol. 1

image thumbnail

Numerical Computing with Simulink, Vol. 1

by

 

08 Sep 2007 (Updated )

This sequel to Numerical Computing with MATLAB explores the mathematics of simulation.

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

% Last Modified by GUIDE v2.5 10-Jan-2007 11:58:59

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @Heating_Control_GUI_OpeningFcn, ...
                   'gui_OutputFcn',  @Heating_Control_GUI_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


% --- Executes just before Heating_Control_GUI is made visible.
function Heating_Control_GUI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% 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 Heating_Control_GUI (see VARARGIN)

% Choose default command line output for Heating_Control_GUI
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes Heating_Control_GUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = Heating_Control_GUI_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press of pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%   This is the Keyboard Entry for the number 1.
block_handle = 'Stateflow_Heating_Controller/User_Selections/11_PB_Gain';
set_gain = '1';
settimeortemp(hObject, eventdata, handles,set_gain,block_handle)

% --- Executes on button press of pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%   This is the Keyboard Entry for the number 2.
block_handle = 'Stateflow_Heating_Controller/User_Selections/11_PB_Gain';
set_gain = '2';
set_param(block_handle,'Gain',set_gain);

% --- Executes on button press of pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%   This is the Keyboard Entry for the number 3.
block_handle = 'Stateflow_Heating_Controller/User_Selections/11_PB_Gain';
set_gain = '3';
set_param(block_handle,'Gain',set_gain);

% --- Executes on button press of pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%   This is the Keyboard Entry for the number 4.
block_handle = 'Stateflow_Heating_Controller/User_Selections/11_PB_Gain';
set_gain = '4';
set_param(block_handle,'Gain',set_gain);

% --- Executes on button press of pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%   This is the Keyboard Entry for the number 5.
block_handle = 'Stateflow_Heating_Controller/User_Selections/11_PB_Gain';
set_gain = '5';
set_param(block_handle,'Gain',set_gain);

% --- Executes on button press of pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%   This is the Keyboard Entry for the number 6.
block_handle = 'Stateflow_Heating_Controller/User_Selections/11_PB_Gain';
set_gain = '6';
set_param(block_handle,'Gain',set_gain);

% --- Executes on button press of pushbutton17.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton17 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%   This is the Keyboard Entry for the number 7.
block_handle = 'Stateflow_Heating_Controller/User_Selections/11_PB_Gain';
set_gain = '7';
set_param(block_handle,'Gain',set_gain);

% --- Executes on button press of pushbutton18.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton18 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%   This is the Keyboard Entry for the number 8.
block_handle = 'Stateflow_Heating_Controller/User_Selections/11_PB_Gain';
set_gain = '8';
set_param(block_handle,'Gain',set_gain);

% --- Executes on button press of pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%   This is the Keyboard Entry for the number 9.
block_handle = 'Stateflow_Heating_Controller/User_Selections/11_PB_Gain';
set_gain = '9';
set_param(block_handle,'Gain',set_gain);

% --- Executes on button press of pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton10 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%   This is the Keyboard Entry for the number 0.
block_handle = 'Stateflow_Heating_Controller/User_Selections/11_PB_Gain';
set_gain = '0';
set_param(block_handle,'Gain',set_gain);

% --- Executes on button press of pushbutton11.
function pushbutton11_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton11 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%   This is the Keyboard Entry "Enter"
%      First, Trigger the enter
block_handle = 'Stateflow_Heating_Controller/User_Selections/Enter_Gain';
set_gain = '1';
set_param(block_handle,'Gain',set_gain);
%      Second, Reset the Pushbuttons
block_handle = 'Stateflow_Heating_Controller/User_Selections/11_PB_Gain';
set_gain = '-1';
set_param(block_handle,'Gain',set_gain);


% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%   When the user makes a new Selection, let Simulink know by changing the
%      Gain block "Setting_SW_Gain".
setting = get(hObject,'Value');
block_handle = 'Stateflow_Heating_Controller/User_Selections/Setting_SW_Gain';
set_param(block_handle,'Gain',num2str(setting));

% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1
%   This is the Selection Options Pull Down Menu.  The Options are:
%           Run
%           Set Time
%           Set Temperature

% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function settimeortemp(hObject, eventdata, handles, set_gain, block_handle)

set_param(block_handle,'Gain',set_gain);

Value = get(handles.popupmenu1, 'Value');
if Value == 2
    % Set Time
    
elseif Value == 3
    % Set Temp
    
end

Contact us