2014-07-24 3 views
1

Matlab에서 GUI를 개발 중이며 버튼을 클릭 할 때 어떤 워크 플로우인지 알고 싶습니다. 더 구체적으로, 버튼을 클릭 할 때 콜백이 트리거되지 않기 때문에 '일어나는 일'을 알고 싶습니다.GUI 워크 플로 명령

+1

줌과 같은 표준 버튼을 의미합니까? 무슨 일이 일어 났는지 알아 내면 뭔가 적어주세요. 나도 관심이있을거야. +1 – patrik

답변

0

당신이 개발 GUIDE를 사용하는 경우, 때마다 당신은 코드의 덩어리가 발생하여 GUI에 단추를 추가 :

% --- Executes on button press in pushbutton1. 
function pushbutton1_Callback(hObject, eventdata, handles) 
% hObject handle to pushbutton1 (see GCBO) 
% eventdata reserved - to be defined in a future version of MATLAB 
% handles structure with handles and user data (see GUIDATA) 

이 기능은 사용자가 상기 버튼을 누를 때마다 호출된다. 따라서 버튼을 클릭 할 때 어떤 것을 실행해야한다면 실행하고자하는 코드 행을 추가하면됩니다. 예를 들어, 당신이 edit text 변수 값으로 edit1을 불렀다 상상

edit1 = 'hello'; 

당신이 handles를 호출 할 필요와 상호 작용하기를 원하지만 먼저 글로벌 변수 작성해야하는 경우 :

%set the current figure handle to main application data 
setappdata(0,'figureHandle',gcf); 
%set the handles to figure's application data 
setappdata(gcf,'EDIT1',handles.edit1); 

을 그런 다음 버튼의 콜백 함수에서 다음을 작성해야합니다.

% --- Executes on button press in pushbutton1. 
function pushbutton1_Callback(hObject, eventdata, handles) 
% hObject handle to pushbutton1 (see GCBO) 
% eventdata reserved - to be defined in a future version of MATLAB 
% handles structure with handles and user data (see GUIDATA) 
figureHandle = getappdata(0,'figureHandle'); 
EDIT1 = getappdata(figureHandle,'EDIT1 '); 
new_string = 'updated string'; 
set(EDIT1, 'String', new_string); 

희망이 있습니다.

+1

감사합니다. 그러나 이것은 제가 찾고있는 것이 아닙니다. 일단 GUI를 개발하게되면 Matlab 명령을 사용하여 작업 과정에서 정보가 전달되는 방식을 알 수 있습니다. '프로파일 러'와 유사하지만 상호 작용합니다. – YisasL

+0

다음과 같은 것을 의미합니다 : http://www.mathworks.es/es/help/matlab/creating_guis/share-data-among-callbacks.html? –

+0

정확하게는 아니지만 유용 할 수 있습니다. 화살표가 있거나 유사한 그래픽을 제공하는 명령이 필요합니다. 함수가 호출되는 시점과 이동하는 위치 등을 보여줍니다. – YisasL

관련 문제