- Time since last event: 0.04 s
- Time since last event: 0.04 s
- Time since last event: 0.04 s
- Time since last event: 0.03 s
- Time since last event: 0.04 s
- Time since last event: 0.04 s
- Time since last event: 0.04 s
- Time since last event: 0.05 s
- Time since last event: 0.05 s
- Time since last event: 0.04 s
- Time since last event: 0.03 s
- Time since last event: 0.03 s
- Time since last event: 0.04 s
- Time since last event: 0.03 s
- Time since last event: 0.04 s
- Time since last event: 0.04 s
- Time since last event: 0.04 s
- Time since last event: 0.04 s
- Time since last event: 0.04 s
extremely bad performance of event issuing by slider uicontrol in version R2020b
1 回表示 (過去 30 日間)
古いコメントを表示
I have observed that in the new version of Matlab, the slider uicontrol does not issue events properly when used continuously. The value of the slider does not change as the user moves the slider.
I attach a function that illustrates this behaviour.
function sliderPerformance
function sliderPerformance
nfig = figure();
x = linspace(0,2*pi,10000);
hplot = plot(x,cos(0*x),'LineWidth',2);
ylim([-2,2]);
h = uicontrol('style','slider','units','pixel','position',[20 20 300 20],'Parent',nfig);
% checks continuosly the update of the value in the slider
addlistener(h,'Value','PostSet',@(hObject, event) updatePlot(hObject, event,x,hplot));
function updatePlot(src,event,x,hplot)
persistent lastVisit
if isempty(lastVisit);
lastVisit = clock();
return
else
thisVisit = clock();
end
fprintf('Time since last event: %5.2f s\n',etime(thisVisit,lastVisit));
hSlider = event.AffectedObject;
n = hSlider.Value;
hplot.YData=cos(x*n);
ylim([-2,2]);
drawnow;
lastVisit = thisVisit;
When operated from any version previous to R2020b, the plot transitions smoothly as the user moves the slider, and (a sample of) the readout to the screen is:
Time since last event: 0.01 s
Time since last event: 0.11 s
Time since last event: 0.06 s
In R2020b, the plot transition is bumpy, and, accordingly the readout:
Time since last event: 0.08 s
Time since last event: 0.47 s
Time since last event: 1.11 s
Time since last event: 2.25 s
Time since last event: 4.51 s
Time since last event: 3.46 s
Time since last event: 4.65 s
Is something that can be done? Is this reportable as a bug?
0 件のコメント
回答 (1 件)
Cris LaPierre
2020 年 12 月 11 日
Your code runs smoothly for me in 20b and 21a prerelease.
Times are
8 件のコメント
Cris LaPierre
2020 年 12 月 14 日
If you are noticing a drastic difference in behavior from one version to another, I know they'd love to hear about it. Sory I couldn't be of more help. You can submit your feedback here.
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!