Graphs and tables using GUI

3 views (last 30 days)
Pratishtha Sharma
Pratishtha Sharma on 12 Jun 2019
Commented: Pratishtha Sharma on 14 Jun 2019
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 Comments
Geoff Hayes
Geoff Hayes on 13 Jun 2019
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 on 14 Jun 2019
Edited: Geoff Hayes on 14 Jun 2019
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))

Sign in to comment.

Answers (1)

Geoff Hayes
Geoff Hayes on 14 Jun 2019
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 Comment
Pratishtha Sharma
Pratishtha Sharma on 14 Jun 2019
Thank you so much actually I had written the same code before but a few things were wriiiten wrong..

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!