Hi
I have made this code to show my table in gui, but the table just pops up and does not show in the gui application
handles.T = table((1:(size(nCoord,1)-1))',x_globalx(:,1),x_globay(:,1),x_globarz(:,1), 'VariableNames',VarNames)
fig = uifigure;
uit = uitable(fig, 'Data',handles.T);
set(handles.uitable1, 'Data', handles.T); ( this is the one i think i have made wrong )

4 comentarios

Adam Danz
Adam Danz el 17 de Feb. de 2020
It looks like you're using a GUIDE GUI. Please confirm.
The line uit=uitable(...) creates the UI table but the UI table should already exist. So, remove that line.
The set(...) line should be sufficient if the handles are all correct.
polo Mahmoud
polo Mahmoud el 18 de Feb. de 2020
hi
Yes I use GUI, but i tried to dele the uit code and only used the set(..) but it did not work.
Adam Danz
Adam Danz el 18 de Feb. de 2020
"Yes I use GUI"
There are several ways to make a GUI in Matlab. I'm asking specificlly if you've used the guide() method. Based on your variable names, I think this is the case.
"...but it did not work"
I don't know what that means. Did you get an error message(if yes, please share the entire copy-pasted error message)? Did the table data no appear? Did something else happen unexpectedly?
polo Mahmoud
polo Mahmoud el 18 de Feb. de 2020
Hi
Yes i have used guide, and the there was error :
Error using matlab.ui.control.Table/set
Functionality not supported with figures created with the figure function. For more information, see
Graphics Support in App Designer.
Error in New_gui_polo_16_02>pushbutton15_Callback (line 966)
set(handles.uitable4, 'Data', handles.T);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in New_gui_polo_16_02 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)New_gui_polo_16_02('pushbutton15_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.

Iniciar sesión para comentar.

 Respuesta aceptada

Adam Danz
Adam Danz el 18 de Feb. de 2020

1 voto

"Error using matlab.ui.control.Table/set; Functionality not supported with figures created with the figure function."
handles.T should be a cell array instead of a table. You can either create the cell array directly instead of creating a table, or you can convert the table to a cell array using table2cell().
Then you can use
set(handles.uitable1, 'Data', handles.T);
% cell array ^^^^^^^^^

3 comentarios

polo Mahmoud
polo Mahmoud el 18 de Feb. de 2020
Thank you very much :D
Adam Danz
Adam Danz el 18 de Feb. de 2020
Glad I could help pinpoint the problem.
Diego Guisasola Plejo
Diego Guisasola Plejo el 6 de Dic. de 2020
Thank you so much, I've been trying to solve this for the past 2 hours and it was a datatype problem. Thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Programmatically en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 17 de Feb. de 2020

Comentada:

el 6 de Dic. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by