Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 13.78 KB | None | 0 0
  1. function varargout = sum(varargin)
  2. % SUM MATLAB code for sum.fig
  3. %      SUM, by itself, creates a new SUM or raises the existing
  4. %      singleton*.
  5. %
  6. %      H = SUM returns the handle to a new SUM or the handle to
  7. %      the existing singleton*.
  8. %
  9. %      SUM('CALLBACK',hObject,eventData,handles,...) calls the local
  10. %      function named CALLBACK in SUM.M with the given input arguments.
  11. %
  12. %      SUM('Property','Value',...) creates a new SUM or raises the
  13. %      existing singleton*.  Starting from the left, property value pairs are
  14. %      applied to the GUI before sum_OpeningFcn gets called.  An
  15. %      unrecognized property name or invalid value makes property application
  16. %      stop.  All inputs are passed to sum_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 sum
  24.  
  25. % Last Modified by GUIDE v2.5 06-Dec-2016 16:47:01
  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', @sum_OpeningFcn, ...
  32.                    'gui_OutputFcn',  @sum_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.  
  48. % --- Executes just before sum is made visible.
  49. function sum_OpeningFcn(hObject, eventdata, handles, varargin)
  50. % This function has no output args, see OutputFcn.
  51. % hObject    handle to figure
  52. % eventdata  reserved - to be defined in a future version of MATLAB
  53. % handles    structure with handles and user data (see GUIDATA)
  54. % varargin   command line arguments to sum (see VARARGIN)
  55.  
  56. % Choose default command line output for sum
  57. handles.output = hObject;
  58.  
  59. % Update handles structure
  60. guidata(hObject, handles);
  61.  
  62. % UIWAIT makes sum wait for user response (see UIRESUME)
  63. % uiwait(handles.figure1);
  64.  
  65.  
  66. % --- Outputs from this function are returned to the command line.
  67. function varargout = sum_OutputFcn(hObject, eventdata, handles)
  68. % varargout  cell array for returning output args (see VARARGOUT);
  69. % hObject    handle to figure
  70. % eventdata  reserved - to be defined in a future version of MATLAB
  71. % handles    structure with handles and user data (see GUIDATA)
  72.  
  73. % Get default command line output from handles structure
  74. varargout{1} = handles.output;
  75.  
  76.  
  77.  
  78. % --- Executes on slider movement.
  79. function slider1_Callback(hObject, eventdata, handles)
  80. val = get(hObject, 'Value');
  81. set_param('Ecv/dB Gain5','db',int2str(val));
  82. s = strcat(int2str(val),' dB');
  83. set(handles.text6, 'String', s);
  84. %x=round(get(hObject,'Value'));
  85. %set(handles.sliderValue_editText, 'String', [int2str(x) ' dB']);
  86. %set_param('Ecv/dB Gain1','db',int2str(x));
  87. % hObject    handle to slider1 (see GCBO)
  88. % eventdata  reserved - to be defined in a future version of MATLAB
  89. % handles    structure with handles and user data (see GUIDATA)
  90.  
  91. % Hints: get(hObject,'Value') returns position of slider
  92. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  93.  
  94.  
  95.  
  96. % --- Executes during object creation, after setting all properties.
  97. function slider1_CreateFcn(hObject, eventdata, handles)
  98. % hObject    handle to slider1 (see GCBO)
  99. % eventdata  reserved - to be defined in a future version of MATLAB
  100. % handles    empty - handles not created until after all CreateFcns called
  101.  
  102. % Hint: slider controls usually have a light gray background.
  103. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  104.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  105. end
  106.  
  107.  
  108. % --- Executes on button press in pushbutton1.
  109. function pushbutton1_Callback(hObject, eventdata, handles)
  110. % hObject    handle to pushbutton1 (see GCBO)
  111. % eventdata  reserved - to be defined in a future version of MATLAB
  112. % handles    structure with handles and user data (see GUIDATA)
  113. x=get(hObject,'String');
  114. if strcmp(x,'Play')
  115. set_param('Ecv', 'SimulationCommand', 'start');
  116. set(hObject,'String', 'Pause');
  117. set(handles.slider1, 'Value', 0);
  118. set(handles.slider2, 'Value', 0);
  119. set(handles.slider3, 'Value', 0);
  120. set(handles.slider4, 'Value', 0);
  121. set(handles.slider5, 'Value', 0);
  122. set(handles.slider7, 'Value', 0);
  123. set(handles.text11, 'String', '0 dB');
  124. set(handles.text10, 'String', '0 dB');
  125. set(handles.text9, 'String', '0 dB');
  126. set(handles.text8, 'String', '0 dB');
  127. set(handles.text7, 'String', '0 dB');
  128. set(handles.text6, 'String', '0 dB');
  129. set_param('Ecv/dB Gain7','db','0');
  130. set_param('Ecv/dB Gain5','db','0');
  131. set_param('Ecv/dB Gain1','db','0');
  132. set_param('Ecv/dB Gain2','db','0');
  133. set_param('Ecv/dB Gain3','db','0');
  134. set_param('Ecv/dB Gain4','db','0');
  135. else if strcmp(x,'Pause')
  136. set_param('Ecv', 'SimulationCommand', 'pause');
  137. set(hObject,'String', 'Continue');
  138.  
  139. else if strcmp(x,'Continue')
  140. set_param('Ecv', 'SimulationCommand', 'continue');
  141. set(hObject,'String', 'Pause');
  142. end
  143. end
  144. end
  145.  
  146.  
  147. % --- Executes on slider movement.
  148. function slider2_Callback(hObject, eventdata, handles)
  149. % hObject    handle to slider2 (see GCBO)
  150. % eventdata  reserved - to be defined in a future version of MATLAB
  151. % handles    structure with handles and user data (see GUIDATA)
  152. val = get(hObject, 'Value');
  153. set_param('Ecv/dB Gain1','db',int2str(val));
  154. s = strcat(int2str(val),' dB');
  155. set(handles.text7, 'String', s);
  156. % Hints: get(hObject,'Value') returns position of slider
  157. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  158.  
  159.  
  160. % --- Executes during object creation, after setting all properties.
  161. function slider2_CreateFcn(hObject, eventdata, handles)
  162. % hObject    handle to slider2 (see GCBO)
  163. % eventdata  reserved - to be defined in a future version of MATLAB
  164. % handles    empty - handles not created until after all CreateFcns called
  165.  
  166. % Hint: slider controls usually have a light gray background.
  167. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  168.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  169. end
  170.  
  171.  
  172. % --- Executes on slider movement.
  173. function slider3_Callback(hObject, eventdata, handles)
  174. % hObject    handle to slider3 (see GCBO)
  175. % eventdata  reserved - to be defined in a future version of MATLAB
  176. % handles    structure with handles and user data (see GUIDATA)
  177. val = get(hObject, 'Value');
  178. set_param('Ecv/dB Gain2','db',int2str(val));
  179. s = strcat(int2str(val),' dB');
  180. set(handles.text8, 'String', s);
  181. % Hints: get(hObject,'Value') returns position of slider
  182. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  183.  
  184.  
  185. % --- Executes during object creation, after setting all properties.
  186. function slider3_CreateFcn(hObject, eventdata, handles)
  187. % hObject    handle to slider3 (see GCBO)
  188. % eventdata  reserved - to be defined in a future version of MATLAB
  189. % handles    empty - handles not created until after all CreateFcns called
  190.  
  191. % Hint: slider controls usually have a light gray background.
  192. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  193.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  194. end
  195.  
  196.  
  197. % --- Executes on slider movement.
  198. function slider4_Callback(hObject, eventdata, handles)
  199. % hObject    handle to slider4 (see GCBO)
  200. % eventdata  reserved - to be defined in a future version of MATLAB
  201. % handles    structure with handles and user data (see GUIDATA)
  202. val = get(hObject, 'Value');
  203. set_param('Ecv/dB Gain3','db',int2str(val));
  204. s = strcat(int2str(val),' dB');
  205. set(handles.text9, 'String', s);
  206. % Hints: get(hObject,'Value') returns position of slider
  207. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  208.  
  209.  
  210. % --- Executes during object creation, after setting all properties.
  211. function slider4_CreateFcn(hObject, eventdata, handles)
  212. % hObject    handle to slider4 (see GCBO)
  213. % eventdata  reserved - to be defined in a future version of MATLAB
  214. % handles    empty - handles not created until after all CreateFcns called
  215.  
  216. % Hint: slider controls usually have a light gray background.
  217. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  218.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  219. end
  220.  
  221.  
  222. % --- Executes on slider movement.
  223. function slider5_Callback(hObject, eventdata, handles)
  224. % hObject    handle to slider5 (see GCBO)
  225. % eventdata  reserved - to be defined in a future version of MATLAB
  226. % handles    structure with handles and user data (see GUIDATA)
  227. val = get(hObject, 'Value');
  228. set_param('Ecv/dB Gain4','db',int2str(val));
  229. s = strcat(int2str(val),' dB');
  230. set(handles.text10, 'String', s);
  231. % Hints: get(hObject,'Value') returns position of slider
  232. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  233.  
  234.  
  235. % --- Executes during object creation, after setting all properties.
  236. function slider5_CreateFcn(hObject, eventdata, handles)
  237. % hObject    handle to slider5 (see GCBO)
  238. % eventdata  reserved - to be defined in a future version of MATLAB
  239. % handles    empty - handles not created until after all CreateFcns called
  240.  
  241. % Hint: slider controls usually have a light gray background.
  242. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  243.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  244. end
  245.  
  246.  
  247. % --- Executes on button press in checkbox1.
  248. function checkbox1_Callback(hObject, eventdata, handles)
  249. % hObject    handle to checkbox1 (see GCBO)
  250. % eventdata  reserved - to be defined in a future version of MATLAB
  251. % handles    structure with handles and user data (see GUIDATA)
  252. val = get(hObject, 'Value');
  253. set_param('Ecv/Manual Switch','sw',int2str(val));
  254. % Hint: get(hObject,'Value') returns toggle state of checkbox1
  255.  
  256.  
  257. % --- Executes on slider movement.
  258. function slider7_Callback(hObject, eventdata, handles)
  259. % hObject    handle to slider7 (see GCBO)
  260. % eventdata  reserved - to be defined in a future version of MATLAB
  261. % handles    structure with handles and user data (see GUIDATA)
  262. val = get(hObject, 'Value');
  263. set_param('Ecv/Pure','db',int2str(val));
  264. s = strcat(int2str(val),' dB');
  265. set(handles.text11, 'String', s);
  266. % Hints: get(hObject,'Value') returns position of slider
  267. %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  268.  
  269.  
  270. % --- Executes during object creation, after setting all properties.
  271. function slider7_CreateFcn(hObject, eventdata, handles)
  272. % hObject    handle to slider7 (see GCBO)
  273. % eventdata  reserved - to be defined in a future version of MATLAB
  274. % handles    empty - handles not created until after all CreateFcns called
  275.  
  276. % Hint: slider controls usually have a light gray background.
  277. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  278.     set(hObject,'BackgroundColor',[.9 .9 .9]);
  279. end
  280.  
  281.  
  282.  
  283. function edit1_Callback(hObject, eventdata, handles)
  284. % hObject    handle to edit1 (see GCBO)
  285. % eventdata  reserved - to be defined in a future version of MATLAB
  286. % handles    structure with handles and user data (see GUIDATA)
  287.  
  288. % Hints: get(hObject,'String') returns contents of edit1 as text
  289. %        str2double(get(hObject,'String')) returns contents of edit1 as a double
  290.  
  291.  
  292. % --- Executes during object creation, after setting all properties.
  293. function edit1_CreateFcn(hObject, eventdata, handles)
  294. % hObject    handle to edit1 (see GCBO)
  295. % eventdata  reserved - to be defined in a future version of MATLAB
  296. % handles    empty - handles not created until after all CreateFcns called
  297.  
  298. % Hint: edit controls usually have a white background on Windows.
  299. %       See ISPC and COMPUTER.
  300. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  301.     set(hObject,'BackgroundColor','white');
  302. end
  303.  
  304.  
  305. % --- Executes during object creation, after setting all properties.
  306. function text6_CreateFcn(hObject, eventdata, handles)
  307. % hObject    handle to text6 (see GCBO)
  308. % eventdata  reserved - to be defined in a future version of MATLAB
  309. % handles    empty - handles not created until after all CreateFcns called
  310.  
  311.  
  312. % --- Executes on button press in pushbutton2.
  313. function pushbutton2_Callback(hObject, eventdata, handles)
  314. % hObject    handle to pushbutton2 (see GCBO)
  315. % eventdata  reserved - to be defined in a future version of MATLAB
  316. % handles    structure with handles and user data (see GUIDATA)
  317. set(handles.slider1, 'Value', 0);
  318. set(handles.slider2, 'Value', 0);
  319. set(handles.slider3, 'Value', 0);
  320. set(handles.slider4, 'Value', 0);
  321. set(handles.slider5, 'Value', 0);
  322. set(handles.slider7, 'Value', 0);
  323. set(handles.text11, 'String', '0 dB');
  324. set(handles.text10, 'String', '0 dB');
  325. set(handles.text9, 'String', '0 dB');
  326. set(handles.text8, 'String', '0 dB');
  327. set(handles.text7, 'String', '0 dB');
  328. set(handles.text6, 'String', '0 dB');
  329. set_param('Ecv/dB Gain7','db','0');
  330. set_param('Ecv/dB Gain5','db','0');
  331. set_param('Ecv/dB Gain1','db','0');
  332. set_param('Ecv/dB Gain2','db','0');
  333. set_param('Ecv/dB Gain3','db','0');
  334. set_param('Ecv/dB Gain4','db','0');
  335.  
  336.  
  337. % --- Executes on button press in pushbutton3.
  338. function pushbutton3_Callback(hObject, eventdata, handles)
  339. % hObject    handle to pushbutton3 (see GCBO)
  340. % eventdata  reserved - to be defined in a future version of MATLAB
  341. % handles    structure with handles and user data (see GUIDATA)
  342. [chosendirectory chosenfile] = uigetfile('*.mp3','Select the Music');
  343. fullchosenfile = [chosenfile chosendirectory];
  344. %filename = imread(fullchosenfile);
  345. s = strcat(chosenfile,chosendirectory);
  346. set(handles.text13, 'String', s);
  347. set_param('Ecv', 'SimulationCommand', 'stop');
  348. set_param('Ecv/From Multimedia File','inputFilename',s);
  349. %sim('Ecv');
  350. set_param('Ecv', 'SimulationCommand', 'pause');
  351. set(handles.pushbutton1,'String', 'Play');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement