Code covered by the BSD License  

Highlights from
ODEvu

image thumbnail
from ODEvu by Vladimir Bondarenko
Ordinary differential equations viewer

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

% Last Modified by GUIDE v2.5 17-Nov-2011 18:27:19

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

% Choose default command line output for odeModelInfo
handles.output = [];

set(handles.edName,'string',varargin{1}{1});
set(handles.edExpr,'string',varargin{1}{2});
set(handles.edXlabel,'string',varargin{1}{3});
set(handles.edYlabel,'string',varargin{1}{4});
% setup the classes list box:
set(handles.lbClass,'string',varargin{2},'value',varargin{3});

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = odeModelInfo_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;
delete(handles.figure1);


function edName_Callback(hObject, eventdata, handles)
% hObject    handle to edName (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,'String') returns contents of edName as text
%        str2double(get(hObject,'String')) returns contents of edName as a double


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

% Hint: edit 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 edExpr_Callback(hObject, eventdata, handles)
% hObject    handle to edExpr (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,'String') returns contents of edExpr as text
%        str2double(get(hObject,'String')) returns contents of edExpr as a double


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

% Hint: edit 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 edXlabel_Callback(hObject, eventdata, handles)
% hObject    handle to edXlabel (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,'String') returns contents of edXlabel as text
%        str2double(get(hObject,'String')) returns contents of edXlabel as a double


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

% Hint: edit 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 edYlabel_Callback(hObject, eventdata, handles)
% hObject    handle to edYlabel (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,'String') returns contents of edYlabel as text
%        str2double(get(hObject,'String')) returns contents of edYlabel as a double


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

% Hint: edit 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


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

% Hints: contents = cellstr(get(hObject,'String')) returns lbClass contents as cell array
%        contents{get(hObject,'Value')} returns selected item from lbClass


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

% Hint: listbox 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


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

cIxs = get(handles.lbClass,'value');
if isempty(cIxs) % no classes assigned
    errordlg('Assign at least one class to the model.','Error');
    return;
end

handles.output = [];
handles.output{1}{1} = get(handles.edName,'string');
handles.output{1}{2} = get(handles.edExpr,'string');
handles.output{1}{3} = get(handles.edXlabel,'string');
handles.output{1}{4} = get(handles.edYlabel,'string');

handles.output{2} = get(handles.lbClass,'string');
handles.output{3} = cIxs;

guidata(hObject,handles);
uiresume;

% --- Executes on button press in pbCancel.
function pbCancel_Callback(hObject, eventdata, handles)
% hObject    handle to pbCancel (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.output = [];
guidata(hObject,handles);
uiresume;


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

cName = inputdlg('Class name:','Add new class', 1);
if ~isempty(cName)
    odeClassList = get(handles.lbClass,'string');
    odeClassList{end+1} = cName{1};
    set(handles.lbClass,'string',odeClassList);
end

Contact us