extremely bad performance of event issuing by slider uicontrol in version R2020b

1 回表示 (過去 30 日間)
Arabarra
Arabarra 2020 年 12 月 11 日
コメント済み: Arabarra 2020 年 12 月 14 日
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?

回答 (1 件)

Cris LaPierre
Cris LaPierre 2020 年 12 月 11 日
Your code runs smoothly for me in 20b and 21a prerelease.
Times are
  • 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
  8 件のコメント
Cris LaPierre
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.
Arabarra
Arabarra 2020 年 12 月 14 日
I''ll do. Thanks Cris!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by