Sign in to comment.
Hello, that is my way to try to get the GUI uitable BAckgroundColor changed. But it is only changing the whole uitable. I want it to just change the row of the checkbox green if the checkbox is 1 and if checkbox is 0, change to red background of the row. Thanks for your help. best regards
function pushbutton2_Callback(hObject, eventdata, handles)
global pushbutton
[num,txt,raw]= xlsread(uigetfile ({'.xlsx'}))anzahl_kriterien = size([raw],1)% --> aendern
kriterium = cell(anzahl_kriterien);
tabledata = [num2cell(true(length(raw),1)),raw];
set(handles.uitable3, 'data',tabledata) setappdata(handles.uitable3,'RawTableDat',raw)
% --- Executes when entered data in editable cell(s) in uitable3. function uitable3_CellEditCallback(hObject, eventdata, handles) tabledata=get(handles.uitable3,'Data');
spalte1=tabledata(:,1) spalte2=tabledata(:,2)
zeilenanzahl=length(tabledata);
% uitablehandles=findobj(handles.uitable3); for j = 1:1:zeilenanzahl %für zeile 1 bis ende
if (spalte1{j,1}==1) tabledata{j,2}=spalte2{j,1}set(handles.uitable3,'BackgroundColor',[0 1 0])
end
for j = 1:1:zeilenanzahl
if (tabledata{j,1}==0) tabledata{j,2}= set(handles.uitable3,'BackgroundColor',[1 0 0])end end end
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function uitable3_CreateFcn(hObject, eventdata, handles)
hObject.ColumnFormat = {'logical',[]};
hObject.ColumnEditable = logical([1 0]);
Sign in to comment.
Sign in to comment.
Hey, i have a similar problem with a Gui uitable and it would be great if you can help me with that. Thaks a lot :)
Sign in to comment.
Sign in to comment.
Opportunities for recent engineering grads.
Apply Today
0 Comments
Sign in to comment.