Graphs and tables using GUI

조회 수: 2 (최근 30일)
Pratishtha Sharma
Pratishtha Sharma 2019년 6월 12일
댓글: Pratishtha Sharma 2019년 6월 14일
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