Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.84 KB | None | 0 0
  1. function varargout = gui1(varargin)
  2. % GUI1 MATLAB code for gui1.fig
  3. % GUI1, by itself, creates a new GUI1 or raises the existing
  4. % singleton*.
  5. %
  6. % H = GUI1 returns the handle to a new GUI1 or the handle to
  7. % the existing singleton*.
  8. %
  9. % GUI1('CALLBACK',hObject,eventData,handles,...) calls the local
  10. % function named CALLBACK in GUI1.M with the given input arguments.
  11. %
  12. % GUI1('Property','Value',...) creates a new GUI1 or raises the
  13. % existing singleton*. Starting from the left, property value pairs are
  14. % applied to the GUI before gui1_OpeningFcn gets called. An
  15. % unrecognized property name or invalid value makes property application
  16. % stop. All inputs are passed to gui1_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 gui1
  24.  
  25. % Last Modified by GUIDE v2.5 27-Apr-2017 17:53:50
  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', @gui1_OpeningFcn, ...
  32. 'gui_OutputFcn', @gui1_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. % --- Executes just before gui1 is made visible.
  47. function gui1_OpeningFcn(hObject, eventdata, handles, varargin)
  48. % This function has no output args, see OutputFcn.
  49. % hObject handle to figure
  50. % eventdata reserved - to be defined in a future version of MATLAB
  51. % handles structure with handles and user data (see GUIDATA)
  52. % varargin command line arguments to gui1 (see VARARGIN)
  53.  
  54. % Choose default command line output for gui1
  55. handles.output = hObject;
  56.  
  57. tile = 4;
  58. tmax = 4000;
  59. nt = 1001;
  60. xmax = 0.05;
  61. nx = 21;
  62. method = 'forward';
  63. % Update handles structure
  64. guidata(hObject, handles);
  65. [x, t, u] = shuttle(tmax, nt, xmax, nx, method, false,tile);
  66. surf(x, t, u);
  67. shading interp
  68.  
  69. xlabel('distance m');
  70. ylabel('time sec');
  71. zlabel('temp C');
  72. % This sets up the initial plot - only do when we are invisible
  73. % so window can get raised using gui1.
  74.  
  75. % UIWAIT makes gui1 wait for user response (see UIRESUME)
  76. % uiwait(handles.figure1);
  77.  
  78.  
  79. % --- Outputs from this function are returned to the command line.
  80. function varargout = gui1_OutputFcn(hObject, eventdata, handles)
  81. % varargout cell array for returning output args (see VARARGOUT);
  82. % hObject handle to figure
  83. % eventdata reserved - to be defined in a future version of MATLAB
  84. % handles structure with handles and user data (see GUIDATA)
  85.  
  86. % Get default command line output from handles structure
  87. varargout{1} = handles.output;
  88.  
  89. % --- Executes on button press in pushbutton1.
  90. function pushbutton1_Callback(hObject, eventdata, handles)
  91. % hObject handle to pushbutton1 (see GCBO)
  92. % eventdata reserved - to be defined in a future version of MATLAB
  93. % handles structure with handles and user data (see GUIDATA)
  94.  
  95.  
  96.  
  97. % --- Executes on selection change in popupmenu1.
  98. function popupmenu1_Callback(hObject, eventdata, handles)
  99. % hObject handle to popupmenu1 (see GCBO)
  100. % eventdata reserved - to be defined in a future version of MATLAB
  101. % handles structure with handles and user data (see GUIDATA)
  102.  
  103. % Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
  104. % contents{get(hObject,'Value')} returns selected item from popupmenu1
  105.  
  106.  
  107. % --- Executes during object creation, after setting all properties.
  108. function popupmenu1_CreateFcn(hObject, eventdata, handles)
  109. % hObject handle to popupmenu1 (see GCBO)
  110. % eventdata reserved - to be defined in a future version of MATLAB
  111. % handles empty - handles not created until after all CreateFcns called
  112.  
  113. % Hint: popupmenu controls usually have a white background on Windows.
  114. % See ISPC and COMPUTER.
  115. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  116. set(hObject,'BackgroundColor','white');
  117. end
  118.  
  119.  
  120.  
  121. % --- Executes on selection change in popupmenu2.
  122. function popupmenu2_Callback(hObject, eventdata, handles)
  123. % hObject handle to popupmenu2 (see GCBO)
  124. % eventdata reserved - to be defined in a future version of MATLAB
  125. % handles structure with handles and user data (see GUIDATA)
  126.  
  127. % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array
  128. % contents{get(hObject,'Value')} returns selected item from popupmenu2
  129.  
  130.  
  131. % --- Executes during object creation, after setting all properties.
  132. function popupmenu2_CreateFcn(hObject, eventdata, handles)
  133. % hObject handle to popupmenu2 (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. % Hint: popupmenu controls usually have a white background on Windows.
  138. % See ISPC and COMPUTER.
  139. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  140. set(hObject,'BackgroundColor','white');
  141. end
  142.  
  143.  
  144. % --- Executes on slider movement.
  145. function slider3_Callback(hObject, eventdata, handles)
  146. % hObject handle to slider3 (see GCBO)
  147. % eventdata reserved - to be defined in a future version of MATLAB
  148. % handles structure with handles and user data (see GUIDATA)
  149.  
  150. % Hints: get(hObject,'Value') returns position of slider
  151. % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  152.  
  153.  
  154. % --- Executes during object creation, after setting all properties.
  155. function slider3_CreateFcn(hObject, eventdata, handles)
  156. % hObject handle to slider3 (see GCBO)
  157. % eventdata reserved - to be defined in a future version of MATLAB
  158. % handles empty - handles not created until after all CreateFcns called
  159.  
  160. % Hint: slider controls usually have a light gray background.
  161. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  162. set(hObject,'BackgroundColor',[.9 .9 .9]);
  163. end
  164.  
  165.  
  166. % --- Executes on slider movement.
  167. function slider5_Callback(hObject, eventdata, handles)
  168. % hObject handle to slider5 (see GCBO)
  169. % eventdata reserved - to be defined in a future version of MATLAB
  170. % handles structure with handles and user data (see GUIDATA)
  171.  
  172. % Hints: get(hObject,'Value') returns position of slider
  173. % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  174.  
  175.  
  176. % --- Executes during object creation, after setting all properties.
  177. function slider5_CreateFcn(hObject, eventdata, handles)
  178. % hObject handle to slider5 (see GCBO)
  179. % eventdata reserved - to be defined in a future version of MATLAB
  180. % handles empty - handles not created until after all CreateFcns called
  181.  
  182. % Hint: slider controls usually have a light gray background.
  183. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  184. set(hObject,'BackgroundColor',[.9 .9 .9]);
  185. end
  186.  
  187.  
  188. %Tile select
  189. % --- Executes on selection change in popupmenu6.
  190. function popupmenu6_Callback(hObject, eventdata, handles)
  191. % hObject handle to popupmenu6 (see GCBO)
  192. % eventdata reserved - to be defined in a future version of MATLAB
  193. % handles structure with handles and user data (see GUIDATA)
  194.  
  195. % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu6 contents as cell array
  196. % contents{get(hObject,'Value')} returns selected item from popupmenu6
  197. contents = cellstr(get(hObject,'String'));
  198. item = contents{get(hObject,'Value')}
  199.  
  200. switch item
  201. case '502'
  202. tile = 1;
  203. case '590'
  204. tile = 2;
  205. case '468'
  206. tile = 3;
  207. case '597'
  208. tile = 4;
  209. case '480'
  210. tile = 5;
  211. case '850'
  212. tile = 6;
  213. case '711'
  214. tile = 7;
  215. case '730'
  216. tile = 8;
  217. end
  218.  
  219. [x, t, u] = shuttle(tmax, nt, xmax, nx, method, false, tile);
  220. surf(x, t, u);
  221. shading interp
  222.  
  223. tmax = 4000;
  224. nt = 1001;
  225. xmax = 0.05;
  226. nx = 21;
  227. method = 'forward';
  228.  
  229. xlabel('distance m');
  230. ylabel('time sec');
  231. zlabel('temp C');
  232.  
  233.  
  234. % --- Executes during object creation, after setting all properties.
  235. function popupmenu6_CreateFcn(hObject, eventdata, handles)
  236. % hObject handle to popupmenu6 (see GCBO)
  237. % eventdata reserved - to be defined in a future version of MATLAB
  238. % handles empty - handles not created until after all CreateFcns called
  239.  
  240. % Hint: popupmenu controls usually have a white background on Windows.
  241. % See ISPC and COMPUTER.
  242. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  243. set(hObject,'BackgroundColor','white');
  244. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement