I need the graph to be plotted inside the axes of GUI instead of popping out.
조회 수: 2 (최근 30일)
이전 댓글 표시
% --- Executes on button press in correlation.
function correlation_Callback(hObject, eventdata, handles)
% hObject handle to correlation (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%eeg_data=str2double(get(handles.input,'String'
# * Item one
# * Item two));
if isfield(handles,'window_orig')
disp('Correlation is being calculated...')
[c d]=size(handles.eeg_data);
TH_corr=handles.TH_corr;
[correlation,y1]=correla(handles.window_orig,c,TH_corr);
handles.correlation=correlation;
handles.y1=y1;
handles.axes1=y1;
% [p q]=size(handles.correlation);
guidata(hObject,handles)
disp(handles)
else
disp('No Data Found!!!')
end
function [correlation,y1]=correla(window,c,TH_corr)
for h=1:c
for l=1:c
X=window(h,:);
Y=window(l,:);
ca=corr2(X,Y);
corr(h,l)=round(ca,2);
end
correlation=corr;
end
[p,q]=size(correlation);
for j=1:(p*q)
if(corr(j)< TH_corr && corr(j) > -TH_corr)
corr(j)=0;
end
end
disp('graph is being plotted....')
figure;
x3=graph(corr,'upper','OmitSelfLoops');
LWidths2= 5*x3.Edges.Weight/max(x3.Edges.Weight);
n1={'C3','C4','Cz','F3','F4','O1','O2','P3','P4','T3','T4'};
y1=plot(x3,'EdgeLabel',x3.Edges.Weight,'LineWidth',abs(LWidths2),'Layout','auto','NodeLabel',n1);
y1.Marker='s';
y1.NodeColor='r';
y1.MarkerSize=6;
y1.EdgeAlpha=0.3;
disp('Correlation is calculated')
댓글 수: 0
채택된 답변
Walter Roberson
2018년 7월 17일
Remove the
figure;
call.
댓글 수: 5
Walter Roberson
2018년 7월 17일
If you have a handle graphics object, then it would already be displayed unless the visibility of the object (or perhaps a container of the object) is set to Off. Unless, that is, what you stored in handles was data rather than the graphics object?
If you have an existing handle graphics object but you need to move it to a different container, then you can set its Parent property. If you have an existing handle graphics object but you need to copy it to a different container, then you can copyobj()
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!