Info
此问题已关闭。 请重新打开它进行编辑或回答。
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 次查看(过去 30 天)
显示 更早的评论
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 个评论
Image Analyst
2016-3-15
Yes, but it's just as bad as this one. You didn't fix the formatting. Anyway, did you see my answer below?
回答(1 个)
Image Analyst
2016-3-15
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!