2015-01-30 2 views
1

그래서 내가 주어진 x, y 및 z 좌표와 함께 scatter3 음모를 그려 GUI 에서이 있습니다.팝업 메뉴와 그래프 포커스 Matlab

function activation(hObject, eventdata, handles) 

cla(handles.eeg_final,'reset') 
axes(handles.eeg_final) 

x = [-30;-50;-40;-60;-60;-60;-30;30;60;60;60;40;50;30]; 
y = [50;30;30;0;20;-60;-80;-80;-60;20;0;30;30;50]; 
z = [30;0;40;30;0;0;10;10;0;0;30;40;0;30]; 

location={}; 
s=cell(1,14); 
for a = 1:14 
    location{1} = sprintf('AF3'); 
    location{2} = sprintf('F7'); 
    location{3} = sprintf('F3'); 
    location{4} = sprintf('FC5'); 
    location{5} = sprintf('T7'); 
    location{6} = sprintf('P7'); 
    location{7} = sprintf('O1'); 
    location{8} = sprintf('O2'); 
    location{9} = sprintf('P8'); 
    location{10} = sprintf('T8'); 
    location{11} = sprintf('FC6'); 
    location{12} = sprintf('F4'); 
    location{13} = sprintf('F8'); 
    location{14} = sprintf('AF4'); 
    n = location{a}; 
    s(a)=strread(sprintf(n),'%s','delimiter',''); 
end 
% the plot 
scatter3(-x,-y,-z,'filled'); % <- NOT <plot3> 
text(-(x+.3),-(y-.5),-z,s,'color',[1,0,0]); 
view(115,18) 

는 나는이 기능과 handles.eeg_final에 초점을 맞추고 다른 함수를 호출하는 플롯 옵션이 있습니다.

function plot_options_popup_Callback(hObject, eventdata, handles) 
% hObject handle to plot_options_popup (see GCBO) 
% eventdata reserved - to be defined in a future version of MATLAB 
% handles structure with handles and user data (see GUIDATA) 
str = get(hObject, 'String'); 
val = get(hObject, 'Value'); 

switch str{val}; 
    case 'EEG Plot - 14 Channel' 
     return 
    case 'Activation Plot' 
     activation 
    case 'Emotion State Plot' 
     emotion_state 
end 

하지만 Activation Plot를 호출 할 때 지금까지 나는 그 말을 오류가 '충분하지 않습니다 인수를.'

누군가 내가 잘못 가고 있다고 말할 수 있습니까?

+0

'(hObject는 EVENTDATA는 처리)'하지만 당신에게 Matlab이 불평하지 않으면 그것을 부르십시오. –

+1

'switch/case' 문에 입력 된 모든 인수를 사용하여 다음과 같이 호출 해보십시오 :'activation (hObject, eventdata, handles)' –

+0

아마도 [menu] (http://se.mathworks.com)에 관심이있을 것입니다. /help/matlab/ref/menu.html)? – patrik

답변

1

입력 인수가 3 개있는 함수 activation을 작성했기 때문에 오류가 발생했습니다. 당신이 좋아하는 기능을 변경할 수 있습니다

function activation(hObject, handles) 

cla(hObject,'reset'); 
axes(hObject); 

% do what you want here 

% update handles struct at the end 
guidata(hObject, handles); 

에 의해 팝업 메뉴에서 전화 : 당신이 3 개 인수를 함수 정의에 잘

activation(handles.eeg_final, handles);