Advertisement
K41t0

Matlab Guide

May 29th, 2014
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 6.38 KB | None | 0 0
  1. function varargout = tampilan2(varargin)
  2. % TAMPILAN2 MATLAB code for tampilan2.fig
  3. %      TAMPILAN2, by itself, creates a new TAMPILAN2 or raises the existing
  4. %      singleton*.
  5. %
  6. %      H = TAMPILAN2 returns the handle to a new TAMPILAN2 or the handle to
  7. %      the existing singleton*.
  8. %
  9. %      TAMPILAN2('CALLBACK',hObject,eventData,handles,...) calls the local
  10. %      function named CALLBACK in TAMPILAN2.M with the given input arguments.
  11. %
  12. %      TAMPILAN2('Property','Value',...) creates a new TAMPILAN2 or raises the
  13. %      existing singleton*.  Starting from the left, property value pairs are
  14. %      applied to the GUI before tampilan2_OpeningFcn gets called.  An
  15. %      unrecognized property name or invalid value makes property application
  16. %      stop.  All inputs are passed to tampilan2_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 tampilan2
  24.  
  25. % Last Modified by GUIDE v2.5 30-May-2014 07:53:31
  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', @tampilan2_OpeningFcn, ...
  32.                    'gui_OutputFcn',  @tampilan2_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 tampilan2 is made visible.
  48. function tampilan2_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 tampilan2 (see VARARGIN)
  54.  
  55. % Choose default command line output for tampilan2
  56. handles.output = hObject;
  57.  
  58.  
  59. % Update handles structure
  60. guidata(hObject, handles);
  61.  
  62. % UIWAIT makes tampilan2 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 = tampilan2_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 button press in pushbutton_balik.
  79. function pushbutton_balik_Callback(hObject, eventdata, handles)
  80. % hObject    handle to pushbutton_balik (see GCBO)
  81. % eventdata  reserved - to be defined in a future version of MATLAB
  82. % handles    structure with handles and user data (see GUIDATA)
  83. GUI_1_handle = tampilan1; % open GUI_1 and save the handle
  84. %delete(get(hObject, 'parent')); % close GUI_1
  85.  
  86. %====================================================================================%
  87.  
  88. % --- Executes on button press in pushbutton_lanjut.
  89. function pushbutton_lanjut_Callback(hObject, eventdata, handles)
  90. % hObject    handle to pushbutton_lanjut (see GCBO)
  91. % eventdata  reserved - to be defined in a future version of MATLAB
  92. % handles    structure with handles and user data (see GUIDATA)
  93.  
  94. %====================================================================================%
  95. % --- Executes on button press in pushbutton_ap1.
  96. function pushbutton_ap1_Callback(hObject, eventdata, handles)
  97. % hObject    handle to pushbutton_ap1 (see GCBO)
  98. % eventdata  reserved - to be defined in a future version of MATLAB
  99. % handles    structure with handles and user data (see GUIDATA)
  100.  
  101. [X,Y] = meshgrid(0:.1:3.0);
  102. Z = peaks(X,Y);
  103. pcolor(Z);
  104. colormap(jet(256));
  105. colorbar;
  106. caxis([1 10]);
  107. shading(gca,'interp');
  108. grid on;
  109. hold;
  110. handles.axes2;
  111. set(gca,'layer','top');
  112.  
  113. % --- Executes on button press in pushbutton_ap2.
  114. function pushbutton_ap2_Callback(hObject, eventdata, handles)
  115. % hObject    handle to pushbutton_ap2 (see GCBO)
  116. % eventdata  reserved - to be defined in a future version of MATLAB
  117. % handles    structure with handles and user data (see GUIDATA)
  118.  
  119.  
  120. % --- Executes on button press in pushbutton_ap3.
  121. function pushbutton_ap3_Callback(hObject, eventdata, handles)
  122. % hObject    handle to pushbutton_ap3 (see GCBO)
  123. % eventdata  reserved - to be defined in a future version of MATLAB
  124. % handles    structure with handles and user data (see GUIDATA)
  125.  
  126.  
  127. % --- Executes on button press in pushbutton_hapus.
  128. function pushbutton_hapus_Callback(hObject, eventdata, handles)
  129. % hObject    handle to pushbutton_hapus (see GCBO)
  130. % eventdata  reserved - to be defined in a future version of MATLAB
  131. % handles    structure with handles and user data (see GUIDATA)
  132. % close all;
  133. %clear all;
  134. cla;
  135.  
  136.  
  137. % --- Executes on button press in pushbutton_denah.
  138. function pushbutton_denah_Callback(hObject, eventdata, handles)
  139. % hObject    handle to pushbutton_denah (see GCBO)
  140. % eventdata  reserved - to be defined in a future version of MATLAB
  141. % handles    structure with handles and user data (see GUIDATA)
  142.  
  143. % tampilkan denah
  144. % X
  145. for i = 1.5:7;
  146.     cur_x = i * 3.8;
  147.     line([cur_x, cur_x], [0 5], 'color', 'r', 'LineWidth', 1.5);
  148. %    drawnow;
  149. end;
  150.  
  151. % Y
  152. for i = 2:7;
  153.     cur_y = i * 4;
  154.     line([0 4],[cur_y, cur_y], 'color', 'r', 'LineWidth', 1.5);
  155. %    drawnow;
  156. end;
  157.  
  158. % X2
  159. for i = 1.5:7;
  160.     cur_x2 = i * 3.8;
  161.     line([cur_x2, cur_x2], [25 30], 'color', 'r', 'LineWidth', 1.5);
  162. %    drawnow;
  163. end;
  164.  
  165. % Y2
  166. for i = 1:8;
  167.     cur_y2 = i * 3.5;
  168.     line([26 30],[cur_y2, cur_y2], 'color', 'r', 'LineWidth', 1.5);
  169. %    drawnow;
  170. end;
  171.  
  172. % X
  173. line( [5.7 cur_x], [5 5], 'color', 'r', 'LineWidth', 1.5);
  174.  
  175. % Y
  176. line( [4 4], [8 cur_y], 'color', 'r', 'LineWidth', 1.5);
  177.  
  178. % X2
  179. line( [5.6 cur_x2], [25 25], 'color', 'r', 'LineWidth', 1.5);
  180.  
  181. % Y2
  182. line( [26 26], [3.5 cur_y2], 'color', 'r', 'LineWidth', 1.5);
  183.  
  184. handles.axes2;
  185. grid on;
  186. hold all;
  187. axis tight;
  188. axis([0 30 0 30]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement