how to connect table with checkbox? dynamic? GUI

조회 수: 3 (최근 30일)
Torsion27
Torsion27 2018년 1월 23일
답변: Torsion27 2018년 4월 10일
Hi i am trying to set as many checkboxes as i have rows in my dynamic table. an than connect the checkbox with his row. Like row1 connected to chekcbox 1, to enable oder disable the row. thanks for helping!
function Szenario_Einlesen_Callback(hObject, eventdata, handles) global Szenario
Szenario = xlsread(uigetfile ({'.xlsx'}))
anzahl_eigenschaften = size(Szenario,1)
%data=eigenschaften
eigenschaften = cell(anzahl_eigenschaften,1);
for i=1:anzahl_eigenschaften
eigenschaften{i,1} = Szenario(i)
set (handles.uitable4 , 'data',eigenschaften)
end
end
function uitable4_CellEditCallback(hObject, eventdata, handles)

답변 (2개)

Jordy Jose
Jordy Jose 2018년 2월 2일
Hi,
One thing you could do is, in the CellEditCallback based on the checkbox state, change the hObject.Data(selectedInd) to eventdata.PreviousData.

Torsion27
Torsion27 2018년 4월 10일
[num,txt,raw]= xlsread(uigetfile ({'.xlsx'})) %pushbutton=[num,txt,raw]; anzahl_kriterien = size([raw],1) %data=eigenschaften kriterium = cell(anzahl_kriterien);
%copyobj(handles.checkbox3) for i=1:anzahl_kriterien
kriterium{i,1} = raw(i)
end tabledata = [num2cell(true(length(raw),1)),raw];%das nur einmal checkbox spalte da ist und am anfang
set(handles.uitable3, 'data',tabledata)
setappdata(handles.uitable3,'RawTableDat',raw)
function uitable3_CreateFcn(hObject, eventdata, handles) hObject.ColumnFormat = {'logical',[]}; hObject.ColumnEditable = logical([1 0]);

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by