MATLAB GUI: Axes do not retain modifications when using the plot function
이전 댓글 표시
Hi, everyone I'm working on a Matlab GUI, I acquire samples over COM, there is a callback every N samples, then I plot them on GUI. The problem is as follow: in GUI Opening Function I make some axes initializations (axes tick, axes limits, axes labels...) and it's all correct when the GUI is opened but as soon as data are plotted the axes loose the lables and part of the YTick personalization. I've attached the code to discuss with you searching for my possible faults.
%Axes initialization
handles.axes1.YTickMode = 'manual';
handles.axes1.XTickMode = 'manual';
handles.axes1.YLimMode = 'manual';
handles.axes1.XLimMode = 'manual';
ytickformat(handles.axes1,'%.2f');
handles.axes1.XLabel.String = 'Samples';
handles.axes1.YLabel.String = 'Voltage';
handles.axes1.YLim = [0 3.0];
handles.axes1.XLim = [0 1000];
handles.axes1.YTick = [0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 2.25 2.5 2.75 3.0];
handles.axes1.XTick = [0 250 500 750 1000];
%Serial Callback
function serialcallback(hObject)
handles = guidata(hObject);
buffer = fread(handles.serConn, 3000, 'uint16');
j=0;
for k = 1:3:3000
j = j+1;
handles.Volt(j) = double(buffer(k))*(3.0/4095.0);
if k > 1
handles.Temp(j-1) = buffer (k-2);
handles.Curr(j-1) = buffer (k-1);
end
end
plot(handles.axes1,handles.Volt);
guidata(hObject,handles);
Thank you to everyone for the support.
댓글 수: 2
Jan
2018년 6월 2일
Please post the relevant part of the code only. It is not efficient to let the readers search for the lines you are talking of. Thanks.
Dario Laezza
2018년 6월 2일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!