How can I read handles data in opc callback function
Show older comments
Hi! I am writing an OPC callback function in matlab! I have a trouble that my OPC callback function can not read the handles data, but the other button callback function can read it. What is the error, please help me, m code is: try handles.data = addgroup(handles.da); handles.dataIDS = {cambien1}; handles.data_itm = additem(handles.data,handles.dataIDS); guidata(hObject, handles); set(handles.data,'DataChangeFcn',{@Data_Group_Callback,handles},'UpdateRate',0); end my Data_Group_Callback function if(handles.data_itm.value==1) axes(handles.capture); vid=handles.vid; pause(3); data=getsnapshot(vid); imshow(data); savename = strcat('doan' ,'hinh', '.jpg'); imwrite(data,savename); x = get(handles.x,'value'); if x==1
axes(handles.processing); RBG = imread('doanhinh.jpg'); bw = imsubtract(RBG(:,:,1), rgb2gray(RBG)); % Convert the resulting grayscale image into a binary image. bw = im2bw(bw,0.18); % Remove all those pixels less than 300px bw = bwareaopen(bw,30);...... my button call back is function red_Callback(hObject, eventdata, handles) % hObject handle to red (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) handles.x=1; guidata(hObject,handles); can not use the handles.x in the function Data_Group_Callback(hObject, eventdata, handles)
Answers (0)
Categories
Find more on Server Connection and Browsing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!