搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  Active_Gui_Plot.zip
资料下载链接地址: https://bbs.pinggu.org/a-1707141.html
本附件包括:
  • Active_Gui_Plot.m
  • Active_Gui_Plot.fig
附件大小:

偶有灵感,做了一个自动画正玄曲线曲线的界面,分享一下

界面文件如下

[hide][/hide]

在figure上移动移动自己的鼠标,按一按自己的鼠标。




主程序:


[hide]

  1. function varargout = Active_Gui_Plot(varargin)
  2. % ACTIVE_GUI_PLOT M-file for Active_Gui_Plot.fig
  3. % ACTIVE_GUI_PLOT, by itself, creates a new ACTIVE_GUI_PLOT or raises the existing
  4. % singleton*.
  5. %
  6. % H = ACTIVE_GUI_PLOT returns the handle to a new ACTIVE_GUI_PLOT or the handle to
  7. % the existing singleton*.
  8. %
  9. % ACTIVE_GUI_PLOT('CALLBACK',hObject,eventData,handles,...) calls the local
  10. % function named CALLBACK in ACTIVE_GUI_PLOT.M with the given input arguments.
  11. %
  12. % ACTIVE_GUI_PLOT('Property','Value',...) creates a new ACTIVE_GUI_PLOT or raises the
  13. % existing singleton*.Starting from the left, property value pairs are
  14. % applied to the GUI before Active_Gui_Plot_OpeningFcn gets called.An
  15. % unrecognized property name or invalid value makes property application
  16. % stop.All inputs are passed to Active_Gui_Plot_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. % Edit the above text to modify the response to help Active_Gui_Plot

  23. % Last Modified by GUIDE v2.5 03-Jan-2015 22:15:34

  24. % Begin initialization code - DO NOT EDIT
  25. gui_Singleton = 1;
  26. gui_State = struct('gui_Name', mfilename, ...
  27. 'gui_Singleton',gui_Singleton, ...
  28. 'gui_OpeningFcn', @Active_Gui_Plot_OpeningFcn, ...
  29. 'gui_OutputFcn',@Active_Gui_Plot_OutputFcn, ...
  30. 'gui_LayoutFcn',[] , ...
  31. 'gui_Callback', []);
  32. if nargin && ischar(varargin{1})
  33. gui_State.gui_Callback = str2func(varargin{1});
  34. end

  35. if nargout
  36. [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
  37. else
  38. gui_mainfcn(gui_State, varargin{:});
  39. end
  40. % End initialization code - DO NOT EDIT


  41. % --- Executes just before Active_Gui_Plot is made visible.
  42. function Active_Gui_Plot_OpeningFcn(hObject, eventdata, handles, varargin)
  43. % This function has no output args, see OutputFcn.
  44. % hObject handle to figure
  45. % eventdatareserved - to be defined in a future version of MATLAB
  46. % handles structure with handles and user data (see GUIDATA)
  47. % varargin command line arguments to Active_Gui_Plot (see VARARGIN)

  48. % Choose default command line output for Active_Gui_Plot
  49. handles.output = hObject;

  50. % Update handles structure
  51. guidata(hObject, handles);

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


  54. % --- Outputs from this function are returned to the command line.
  55. function varargout = Active_Gui_Plot_OutputFcn(hObject, eventdata, handles)
  56. % varargoutcell array for returning output args (see VARARGOUT);
  57. % hObject handle to figure
  58. % eventdatareserved - to be defined in a future version of MATLAB
  59. % handles structure with handles and user data (see GUIDATA)

  60. % Get default command line output from handles structure
  61. varargout{1} = handles.output;


  62. % --- Executes when user attempts to close figure1.
  63. function figure1_CloseRequestFcn(hObject, eventdata, handles)
  64. % hObject handle to figure1 (see GCBO)
  65. % eventdatareserved - to be defined in a future version of MATLAB
  66. % handles structure with handles and user data (see GUIDATA)

  67. % Hint: delete(hObject) closes the figure
  68. delete(hObject);
  69. clear all


  70. % --- Executes on mouse press over figure background, over a disabled or
  71. % --- inactive control, or over an axes background.
  72. function figure1_WindowButtonDownFcn(hObject, eventdata, handles)
  73. % hObject handle to figure1 (see GCBO)
  74. % eventdatareserved - to be defined in a future version of MATLAB
  75. % handles structure with handles and user data (see GUIDATA)
  76. persistent g
  77. if isempty(g)
  78. g=0;
  79. end
  80. cla
  81. set(gca,'visible','off')
  82. g=g+1;
  83. set(hObject,'userdata',g)

  84. % --- Executes on mouse motion over figure - except title and menu.
  85. function figure1_WindowButtonMotionFcn(hObject, eventdata, handles)
  86. % hObject handle to figure1 (see GCBO)
  87. % eventdatareserved - to be defined in a future version of MATLAB
  88. % handles structure with handles and user data (see GUIDATA)
  89. persistent c
  90. if isempty(c)
  91. c=0;
  92. end
  93. c=c+1;
  94. g=get(hObject,'userdata');
  95. t=0:0.1:c*pi/200;
  96. if g==0
  97. plot(sin(t),'ks-','markerface','r','markersize',8)
  98. elseif g==1
  99. plot(sin(t),'ko-','markerface','m','markersize',8)
  100. elseif g==2
  101. plot(sin(t),'kp-','markerface','g','markersize',8)
  102. else
  103. plot(sin(t),'kv-','markerface','c','markersize',8)
  104. end
  105. drawnow;
复制代码

[/hide]


在理解与学习MATLAB中,需要大家是个多面手 —————— by faruto




    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2025-12-30 04:48