Matlab is generating the 'reference to non-existent field' error for my code. As below there is the error in my code.
Reference to non-existent field 'labelList'. Error in innalillah>draw_Callback (line 156) num = get(handles.labelList,'Value');
function draw_Callback(hObject, eventdata, handles)% hObject handle to draw (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
images = getappdata(0, 'images');method = getappdata(0, 'method');img = getappdata(0, 'img');num = get(handles.labelList,'Value'); %Reference to non-existent field 'labelList'.
buf = [];if method == 3 axes(handles.imgArea); hold on; h = imshow(img); replot_seeds(handles); hold off; e = imfreehand(gca); mask = uint8(createMask(e, h)); switch num case 1 buf = mask; if isempty(images.regionOne) images.regionOne = buf; else [xx, yy] = find(buf == num); for n = 1:length(xx) images.regionOne(xx(n), yy(n)) = num; end end case 2 buf = mask * num; if isempty(images.regionTwo) images.regionTwo = buf; else [xx, yy] = find(buf == 2); for n = 1:length(xx) images.regionTwo(xx(n), yy(n)) = num; end end case 3 buf = mask * num; if isempty(images.regionThree) images.regionThree = buf; else [xx, yy] = find(buf == 3); for n = 1:length(xx) images.regionThree(xx(n), yy(n)) = 3; end end case 4 buf = mask * num; if isempty(images.regionFour) images.regionFour = buf; else [xx, yy] = find(buf == num); for n = 1:length(xx) images.regionFour(xx(n), yy(n)) = num; end end case 5 buf = mask * num; if isempty(images.regionFive) images.regionFive = buf; else [xx, yy] = find(buf == num); for n = 1:length(xx) images.regionFive(xx(n), yy(n)) = num; end end end setappdata(0, 'images', images); replot_seeds(handles);else [~,xpts,ypts] = freehanddraw(handles.imgArea,'color',handles.LST{num},'linewidth', 2); buf=[xpts,ypts]; buf = (floor(buf)); buf(end + 1, :) = NaN; switch num case 1 if isempty(images.labelOne) images.labelOne = buf; else label = images.labelOne; images.labelOne = double([label;buf]); end case 2 if isempty(images.labelTwo) images.labelTwo = buf; else label = images.labelTwo; images.labelTwo = double([label;buf]); end case 3 if isempty(images.labelThree) images.labelThree = buf; else label = images.labelThree; images.labelThree = double([label;buf]); end case 4 if isempty(images.labelFour) images.labelFour = buf; else label = images.labelFour; images.labelFour = double([label;buf]); end case 5 if isempty(images.labelFive) images.labelFive = buf; else label = images.labelFive; images.labelFive = double([label;buf]); end otherwise endendassignin('base', 'buf', buf);setappdata(0, 'images', images);%guidata(gcbo,handles);
Best Answer