楼主: lixuewei3
1839 1

[问答] matlab GUI界面变量排序和按钮问题 [推广有奖]

  • 6关注
  • 4粉丝

副教授

67%

还不是VIP/贵宾

-

威望
0
论坛币
-330309 个
通用积分
3352.2543
学术水平
19 点
热心指数
37 点
信用等级
23 点
经验
29984 点
帖子
1067
精华
0
在线时间
710 小时
注册时间
2014-1-13
最后登录
2024-4-23

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
想做一个MATLAB界面,界面里包括是个独立的版块,第一次接触,还望大神给与帮助,要求有两个,一是根据每一个版块左上角的按钮(起名“提取数据”)来达到点击按钮提取该模块数据导入到一个excel的目的,二是要求点击每一列的变量名可以达到排序的目的;目前代码如下:
  1. function varargout = untitled0328(varargin)
  2. % UNTITLED0328 MATLAB code for untitled0328.fig
  3. %      UNTITLED0328, by itself, creates a new UNTITLED0328 or raises the existing
  4. %      singleton*.
  5. %
  6. %      H = UNTITLED0328 returns the handle to a new UNTITLED0328 or the handle to
  7. %      the existing singleton*.
  8. %
  9. %      UNTITLED0328('CALLBACK',hObject,eventData,handles,...) calls the local
  10. %      function named CALLBACK in UNTITLED0328.M with the given input arguments.
  11. %
  12. %      UNTITLED0328('Property','Value',...) creates a new UNTITLED0328 or raises the
  13. %      existing singleton*.  Starting from the left, property value pairs are
  14. %      applied to the GUI before untitled0328_OpeningFcn gets called.  An
  15. %      unrecognized property name or invalid value makes property application
  16. %      stop.  All inputs are passed to untitled0328_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 untitled0328

  23. % Last Modified by GUIDE v2.5 28-Mar-2017 21:45:37

  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', @untitled0328_OpeningFcn, ...
  29.                    'gui_OutputFcn',  @untitled0328_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 untitled0328 is made visible.
  42. function untitled0328_OpeningFcn(hObject, eventdata, handles, varargin)
  43. % This function has no output args, see OutputFcn.
  44. % hObject    handle to figure
  45. % eventdata  reserved - 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 untitled0328 (see VARARGIN)

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

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

  52. % UIWAIT makes untitled0328 wait for user response (see UIRESUME)
  53. % uiwait(handles.figure1);
  54. guidata(hObject, handles);
  55. %左边最上面
  56. X=xlsread('C:\Users\Administrator\Documents\Tencent Files\1099491745\FileRecv\灰色关联数据-20170320.xlsx','A4:M14');

  57. columenname={'年份','RY(千人)','RZ(亿元)','NI(亿元)','NP(亿元)','ZL(个数)','IP(亿元)','OPI(亿元)','FGI(亿元)','CZC(亿元)','CHZ()','BTL CGC(亿元'};
  58. handle(uitable('data',X,'Position',[0,300,700,300],'ColumnName',columenname));
  59. %左边最小面
  60. X=xlsread('C:\Users\Administrator\Documents\Tencent Files\1099491745\FileRecv\灰色关联数据-20170320.xlsx','A4:M14');
  61. columenname={'年份','RY(千人)','RZ(亿元)','NI(亿元)','NP(亿元)','ZL(个数)','IP(亿元)','OPI(亿元)','FGI(亿元)','CZC(亿元)','CHZ()','BTL CGC(亿元'};
  62. handle(uitable('data',X,'Position',[0,0,700,300],'ColumnName',columenname));
  63. %右边最上面
  64. X=xlsread('C:\Users\Administrator\Documents\Tencent Files\1099491745\FileRecv\灰色关联数据-20170320.xlsx','A4:M14');
  65. columenname={'年份','RY(千人)','RZ(亿元)','NI(亿元)','NP(亿元)','ZL(个数)','IP(亿元)','OPI(亿元)','FGI(亿元)','CZC(亿元)','CHZ()','BTL CGC(亿元'};
  66. handle(uitable('data',X,'Position',[600,300,700,300],'ColumnName',columenname));
  67. %右边最小面
  68. X=xlsread('C:\Users\Administrator\Documents\Tencent Files\1099491745\FileRecv\灰色关联数据-20170320.xlsx','A4:M14');
  69. columenname={'年份','RY(千人)','RZ(亿元)','NI(亿元)','NP(亿元)','ZL(个数)','IP(亿元)','OPI(亿元)','FGI(亿元)','CZC(亿元)','CHZ()','BTL CGC(亿元'};
  70. handle(uitable('data',X,'Position',[600,0,700,300],'ColumnName',columenname));


  71. % --- Outputs from this function are returned to the command line.
  72. function varargout = untitled0328_OutputFcn(hObject, eventdata, handles)
  73. % varargout  cell array for returning output args (see VARARGOUT);
  74. % hObject    handle to figure
  75. % eventdata  reserved - to be defined in a future version of MATLAB
  76. % handles    structure with handles and user data (see GUIDATA)

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


  79. % --- Executes on button press in pushbutton1.
  80. function pushbutton1_Callback(hObject, eventdata, handles)
  81. % hObject    handle to pushbutton1 (see GCBO)
  82. % eventdata  reserved - to be defined in a future version of MATLAB
  83. % handles    structure with handles and user data (see GUIDATA)


  84. % --- Executes on button press in pushbutton2.
  85. function pushbutton2_Callback(hObject, eventdata, handles)
  86. % hObject    handle to pushbutton2 (see GCBO)
  87. % eventdata  reserved - to be defined in a future version of MATLAB
  88. % handles    structure with handles and user data (see GUIDATA)


  89. % --- Executes on button press in pushbutton3.
  90. function pushbutton3_Callback(hObject, eventdata, handles)
  91. % hObject    handle to pushbutton3 (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. % --- Executes on button press in pushbutton4.
  95. function pushbutton4_Callback(hObject, eventdata, handles)
  96. % hObject    handle to pushbutton4 (see GCBO)
  97. % eventdata  reserved - to be defined in a future version of MATLAB
  98. % handles    structure with handles and user data (see GUIDATA)
复制代码



二维码

扫码加我 拉你入群

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

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

关键词:MATLAB atlab matla Lab GUI Tencent Documents matlab excel Users

沙发
lixuewei3 发表于 2017-3-28 21:53:35 |只看作者 |坛友微信交流群
两个问题其实也是可以转化为一个问题,就是如何让那个按钮置于顶层,因为我添加按钮后,每次就会被表格覆盖,拜托了各位大神,急求帮助

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-28 20:58