How to edit dynamically generated checkboxes with uitable from the GUIDE environment in MATLAB?

4 次查看(过去 30 天)
Hi Guys,
I would like to create a table with as many rows with checkboxes as the user wants to create. I did so with the 'uitable-object' in the Matlab GUIDE environment. The necessary checkboxes are created in the Opening function of the GUI.
Unfortunately the checkboxes added are not editable...i cannot check or uncheck them. Here is the opening function of the GUI.
function Try1_bus_OpeningFcn(hObject, eventdata, handles, varargin)
% Choose default command line output for Try1_bus
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
hMainGui = findobj('Tag','bus_') %get the GUI figure
handlesGui_bus = guidata(hMainGui)
usernumber=30 %number buses in the network
display(handles)
for i=1:usernumber
if i==1
newRow={[1] ['Bus', num2str(i)]}
newData= [newRow]
set( handlesGui_bus.uitable_,'Data',newData)
end
oldData = get( handlesGui_bus.uitable_,'Data')
newRow={[1] ['Bus', num2str(i)]}
newData = [oldData; newRow];
set( handlesGui_bus.uitable_,'Data',newData)
end
How can i make the checkboxes editable? the first if-nesting i had to do somehow because otherwise the table would have looked like this:
Strangely I couldnt remove this first 4 checkboxes you see on the picture with GUIDE. Those 4 checkboxes in the beginning still were editable but all the ones that i added with the code above were uneditable.
I would be very glad for your help! The fig and m files are attached!
Best regards, John

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by