No BSD License  

Highlights from
GUI and simple failure handling for aircraft model

image thumbnail

GUI and simple failure handling for aircraft model

by

John Kluza (view profile)

 

11 Oct 2007 (Updated )

GUI and simple failure handling for aircraft model

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

% Copyright 2002-2003 The MathWorks, Inc.

% Edit the above text to modify the response to help aerogaugegui

% Last Modified by GUIDE v2.5 02-Mar-2005 11:10:35

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @aerogaugegui_OpeningFcn, ...
                   'gui_OutputFcn',  @aerogaugegui_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 aerogaugegui is made visible.
function aerogaugegui_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 aerogaugegui (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

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

assignin('base','handles',handles);



% --- Outputs from this function are returned to the command line.
function varargout = aerogaugegui_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 slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject    handle to slider1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider

stickinput=get(hObject, 'Value');
set_param('aerogaugef14/GUI pilot input', 'Value', num2str(-stickinput));


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

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



% --- Executes on button press in stopsim.
function stopsim_Callback(hObject, eventdata, handles)
% hObject    handle to stopsim (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set_param('aerogaugef14', 'SimulationCommand', 'stop')
set(handles.text6, 'String', get_param('aerogaugef14', 'SimulationStatus'))


% --- Executes on button press in startsim.
function startsim_Callback(hObject, eventdata, handles)
% hObject    handle to startsim (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set_param('aerogaugef14', 'SimulationCommand', 'start')




% --------------------------------------------------------------------
function activex1_Change(hObject, eventdata, handles)
% hObject    handle to activex1 (see GCBO)
% eventdata  structure with parameters passed to COM event listerner
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function activex1_Turn(hObject, eventdata, handles)
% hObject    handle to activex1 (see GCBO)
% eventdata  structure with parameters passed to COM event listerner
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function activex3_Change(hObject, eventdata, handles)
% hObject    handle to activex3 (see GCBO)
% eventdata  structure with parameters passed to COM event listerner
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function activex3_Turn(hObject, eventdata, handles)
% hObject    handle to activex3 (see GCBO)
% eventdata  structure with parameters passed to COM event listerner
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function activex4_Change(hObject, eventdata, handles)
% hObject    handle to activex4 (see GCBO)
% eventdata  structure with parameters passed to COM event listerner
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function activex4_Turn(hObject, eventdata, handles)
% hObject    handle to activex4 (see GCBO)
% eventdata  structure with parameters passed to COM event listerner
% handles    structure with handles and user data (see GUIDATA)


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

% Hint: get(hObject,'Value') returns toggle state of w2sensor

set_param('aerogaugef14/w sensor failure handler/Fail Switch2', 'sw', num2str(get(hObject,'Value')))


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

% Hint: get(hObject,'Value') returns toggle state of w1sensor

set_param('aerogaugef14/w sensor failure handler/Fail Switch1', 'sw', num2str(get(hObject,'Value')))

Contact us