Graphs and tables using GUI

3 次查看(过去 30 天)
Pratishtha Sharma
Pratishtha Sharma 2019-6-12
I want to create a GUI for ploting a histogram and a plot simultaneously..but i am not able to make it in a single GUI..also i want to add two tables in it..but i want to change the output of the table according to data i add everytime. I have made the histogram but rest of it is missing
  2 个评论
Geoff Hayes
Geoff Hayes 2019-6-13
Pratishtha - please clarify what you mean by but i am not able to make it in a single GUI. You may want to show some of your code so that we can get an idea of what you have attempted. Also, how do you add the (new) data that you want to show in the table?
Pratishtha Sharma
Pratishtha Sharma 2019-6-14
编辑:Geoff Hayes 2019-6-14
MLC = 1:60 ;
m =[ MLC(:)];
ERR_A = [NET_1(:)];
ERR_B = [NET_B1(:)];
net_a_b_error = [m ERR_A ERR_B];
U = uitable('Data', net_a_b_error);
set(handles.uitable2,'Data',num2cell (U(:)))
T = { er(1) 100*ERROR(1)/sum(ERROR); er(2) 100*ERROR(2)/sum(ERROR); er(3) 100*ERROR(3)/sum(ERROR); er(4) 100*ERROR(4)/sum(ERROR); er(5) 100*ERROR(5)/sum(ERROR); er(6) 100*ERROR(6)/sum(ERROR)};
uit = uitable('Data',T)
set(handles.table1, 'Data', uit)
This is the code I used for adding the tables in the gui but i was not able to add it. Also I donot know how will it change everytime i add the data.
The error I am getting is
Error using matlab.ui.control.Table/set
While setting the 'Data' property of Table:
Values within a cell array must be numeric, logical, or char
Error in gui_1>pushbutton1_Callback (line 154)
set(handles.uitable2,'Data',num2cell (U(:)))
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in gui_1 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)gui_1('pushbutton1_Callback',hObject,eventdata,guidata(hObject))

请先登录,再进行评论。

回答(1 个)

Geoff Hayes
Geoff Hayes 2019-6-14
Pratishtha - your code is
U = uitable('Data', net_a_b_error);
set(handles.uitable2,'Data',num2cell (U(:)))
Why are you creating a new uitable when you already have one in your GUI? And so the second line of code tries to set the uitable with a uitable (?). I think that you want to do something more like
net_a_b_error = [m ERR_A ERR_B];
set(handles.uitable2,'Data',num2cell(net_a_b_error))
and (later)
set(handles.table1, 'Data', T)
  1 个评论
Pratishtha Sharma
Pratishtha Sharma 2019-6-14
Thank you so much actually I had written the same code before but a few things were wriiiten wrong..

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by