I finally found the solution here:
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 Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!