필터 지우기
필터 지우기

How can i use a global var with call_back functions?

조회 수: 1 (최근 30일)
Edward P
Edward P 2011년 11월 3일
The problem is: how can i declare a global var, so i can use it on all functions of my guidata?
for example:
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
----> cpselect(E,D);
guidata(hObject, handles);
% --- Executes on button press in Inserir.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% Invoca duas fotos
echo ImRectOpen off;
-----> global E D;
[E,D]=ImRectOpen();
imshow(E,'Parent',handles.axes3);
imshow(D,'Parent',handles.axes4);
set(handles.pushbutton1,'enable','on');
set(handles.pushbutton5,'enable','on');
guidata(hObject, handles);
First, i've ran the pushbutton_callback4 and then pushbutton_callback5. On pushbutton_callback5 global variables (E and D) that were declared on pushbutton_callback4, cant be found.

채택된 답변

Walter Roberson
Walter Roberson 2011년 11월 3일

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by