Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

i am trying to build a gui in which first popupmenu1 having code which gives results as 'rs' and i want to pass that result to next popupmenu2 i have used guidata to do so but i am getting error " reference to non existance field "

1 visualización (últimos 30 días)
the code I have write as function popupmenu1_Callback(hObject, eventdata, handles)
switch get(handles.category,'string')
case 'Tomato' % User selects Peaks.
%%%%%%%%%%%%maturity %%%%%%%%%%%%
a=imread('picview_tmpEnvironmental214.jpg');
b=a;
a=rgb2gray(a);
a=im2bw(a,.5);
[m,n]=size(a);
a=~a;
figure,
imshow(a);
count=0;
for i=1:m
for j=1:n
if(a(i,j)==1)
count=count+1;
end
end
end
a=b;
[rows cols plane] = size(a);
rplane = a( : , : ,1);
gplane = a( : , : ,2);
bplane = a( : , : ,3);
flag=0;
for x=1:1:rows;
for y=1:1:cols
if ((128 < rplane(x,y) & rplane(x,y) <= 255) & (0 < gplane(x,y) & gplane(x,y) <= 128) & (0 < bplane(x,y) & bplane(x,y) <= 128))
flag=1+flag;
end
end
end
K=count;
%K=rows*cols-%no of white or black pixels(that meance pixels other than fruit pixels);
rs = (flag/K)*100;
handles.rs=rs;
guidata(hObject,handles)
%%%%%%%%%%%%defect on the basis of colour %%%%%%%%%%%%%%%%%%%%%%%%
case 'Mango' % User selects Membrane.
case 'Apple ju ju be' % User selects Sinc.
case 'Orange'
otherwise;
end
function popupmenu2_Callback(hObject, eventdata, handles)
rs3=handles.rs;
please suggest the solution
  3 comentarios
Image Analyst
Image Analyst el 15 de Mzo. de 2016
Yes, but it's just as bad as this one. You didn't fix the formatting. Anyway, did you see my answer below?

Respuestas (1)

Image Analyst
Image Analyst el 15 de Mzo. de 2016
Set a breakpoint on the line where you assign it and see if it stops there. I bet it does not get to that line at all.

Community Treasure Hunt

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

Start Hunting!

Translated by