rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
default_plot_control.m
Go to the documentation of this file.
1 function varargout = default_plot_control(varargin)
2 % DEFAULT_PLOT_CONTROL M-file for default_plot_control.fig
3 % DEFAULT_PLOT_CONTROL, by itself, creates a new DEFAULT_PLOT_CONTROL or raises the existing
4 % singleton*.
5 %
6 % H = DEFAULT_PLOT_CONTROL returns the handle to a new DEFAULT_PLOT_CONTROL or the handle to
7 % the existing singleton*.
8 %
9 % DEFAULT_PLOT_CONTROL('CALLBACK',hObject,eventData,handles,...) calls the local
10 % function named CALLBACK in DEFAULT_PLOT_CONTROL.M with the given input arguments.
11 %
12 % DEFAULT_PLOT_CONTROL('Property','Value',...) creates a new DEFAULT_PLOT_CONTROL or raises the
13 % existing singleton*. Starting from the left, property value pairs are
14 % applied to the GUI before default_plot_control_OpeningFcn gets called. An
15 % unrecognized property name or invalid value makes property application
16 % stop. All inputs are passed to default_plot_control_OpeningFcn via varargin.
17 %
18 % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
19 % instance to run (singleton)".
20 %
21 % See also: GUIDE, GUIDATA, GUIHANDLES
22 
23 % Edit the above text to modify the response to help default_plot_control
24 
25 % Last Modified by GUIDE v2.5 09-Feb-2012 22:35:12
26 
27 % Begin initialization code - DO NOT EDIT
28 gui_Singleton = 1;
29 gui_State = struct('gui_Name', mfilename, ...
30  'gui_Singleton', gui_Singleton, ...
31  'gui_OpeningFcn', @default_plot_control_OpeningFcn, ...
32  'gui_OutputFcn', @default_plot_control_OutputFcn, ...
33  'gui_LayoutFcn', [] , ...
34  'gui_Callback', []);
35 if nargin && ischar(varargin{1})
36  gui_State.gui_Callback = str2func(varargin{1});
37 end
38 
39 if nargout
40  [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
41 else
42  gui_mainfcn(gui_State, varargin{:});
43 end
44 % End initialization code - DO NOT EDIT
45 
46 
47 % --- Executes just before default_plot_control is made visible.
48 function default_plot_control_OpeningFcn(hObject, eventdata, handles, varargin)
49 % This function has no output args, see OutputFcn.
50 % hObject handle to figure
51 % eventdata reserved - to be defined in a future version of MATLAB
52 % handles structure with handles and user data (see GUIDATA)
53 % varargin command line arguments to default_plot_control (see VARARGIN)
54 
55 % Choose default command line output for default_plot_control
56 handles.output = hObject;
57 
58 % Update handles structure
59 guidata(hObject, handles);
60 
61 % UIWAIT makes default_plot_control wait for user response (see UIRESUME)
62 % uiwait(handles.figure1);
63 
64 
65 % --- Outputs from this function are returned to the command line.
66 function varargout = default_plot_control_OutputFcn(hObject, eventdata, handles)
67 % varargout cell array for returning output args (see VARARGOUT);
68 % hObject handle to figure
69 % eventdata reserved - to be defined in a future version of MATLAB
70 % handles structure with handles and user data (see GUIDATA)
71 
72 % Get default command line output from handles structure
73 varargout{1} = handles.output;
74 
75 
76 % --- Executes on button press in reloadButton.
77 function reloadButton_Callback(hObject, eventdata, handles)
78 % hObject handle to reloadButton (see GCBO)
79 % eventdata reserved - to be defined in a future version of MATLAB
80 % handles structure with handles and user data (see GUIDATA)
81 ud = get(gcbf, 'UserData');
82 dt = ud.descr.dt;
83 
84 tval = get(handles.timeSlider, 'Value');
85 timestep = ceil(tval/dt);
86 plot_params.timestep = timestep;
87 plot_params.gcf = gcbf;
88 plot_params.reload_required = true;
89 plot_sim_data(ud.dmodel, [], ud.sim_data, plot_params);
90 
91 % --- Executes on slider movement.
92 function timeSlider_Callback(hObject, eventdata, handles)
93 % hObject handle to timeSlider (see GCBO)
94 % eventdata reserved - to be defined in a future version of MATLAB
95 % handles structure with handles and user data (see GUIDATA)
96 
97 ud = get(gcbf, 'UserData');
98 set(hObject, 'Min', 0);
99 set(hObject, 'Max', ud.descr.T);
100 set(hObject, 'SliderStep', [ud.descr.dt, 10*ud.descr.dt]);
101 dt = ud.descr.dt;
102 val = get(hObject, 'Value');
103 set(handles.time, 'String', ['time = ', num2str(val)]);
104 timestep = ceil(val/dt);
105 plot_params.timestep = timestep;
106 plot_params.gcf = gcbf;
107 plot_sim_data(ud.dmodel, [], ud.sim_data, plot_params);
108 % Hints: get(hObject,'Value') returns position of slider
109 % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
110 
111 
112 % --- Executes during object creation, after setting all properties.
113 function timeSlider_CreateFcn(hObject, eventdata, handles)
114 % hObject handle to timeSlider (see GCBO)
115 % eventdata reserved - to be defined in a future version of MATLAB
116 % handles empty - handles not created until after all CreateFcns called
117 
118 % Hint: slider controls usually have a light gray background.
119 if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
120  set(hObject,'BackgroundColor',[.9 .9 .9]);
121 end
122 
123 
124 % --- Executes on button press in exitButton.
125 function exitButton_Callback(hObject, eventdata, handles)
126 % hObject handle to exitButton (see GCBO)
127 % eventdata reserved - to be defined in a future version of MATLAB
128 % handles structure with handles and user data (see GUIDATA)
129 close(gcbf);
130 
131 % --- Executes during object creation, after setting all properties.
132 function figure1_CreateFcn(hObject, eventdata, handles)
133 % hObject handle to figure1 (see GCBO)
134 % eventdata reserved - to be defined in a future version of MATLAB
135 % handles empty - handles not created until after all CreateFcns called
136 
137 
function p = plot_sim_data(model, model_data, sim_data, plot_params)
function performing the plot of the simulation results as specified in model.
Definition: plot_sim_data.m:17
function varargout = default_plot_control(varargin)
DEFAULT_PLOT_CONTROL M-file for default_plot_control.fig DEFAULT_PLOT_CONTROL, by itself...