App Designer refresh rate of UI elements is too low. Any way to boost it?

7 views (last 30 days)
I have an app designer application which - amongst other things - receives data via serial connection. To display the data, I use linear gauges, although the issue arises in all app designer ui elements. The code below demonstrates the issue. A timer changes the value of the LinearGauge every ~20 ms, however it is effectively updated with a refresh rate just slightly above 1 Hz. That is certainly way too low for my application.
I tested this with two different Windows 7 machines and R2016b. The task manager doesn't show any high load. So I assume this is hard capped somewhere.
My question: Is this resolved in R2017a? If not, can I do something about it? The App Designer is really great and fun to work with, but the slow UI elements are a serious bummer.
Thanks in advance!
Here's testapp.mlapp to demonstrate the issue:
classdef testapp < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
GaugeLabel matlab.ui.control.Label
Gauge matlab.ui.control.SemicircularGauge
end
properties (Access = private)
tim_the_timer
i = 0;
end
methods (Access = private)
function app = refreshMeter(app, ~,~)
% display timestamp
datestr(now,'HH:MM:SS.FFF')
% update the gauge
app.Gauge.Value = app.i;
app.i = app.i + 1;
if app.i > 100
app.i = 0;
end
end
end
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
t = timer;
t.TimerFcn = @app.refreshMeter;
t.Period = 0.02;
t.BusyMode = 'drop';
t.ExecutionMode = 'fixedRate';
start(t);
app.tim_the_timer = t;
end
% Close request function: UIFigure
function UIFigureCloseRequest(app, event)
stop(app.tim_the_timer);
delete(app.tim_the_timer);
delete(app);
end
end
% App initialization and construction
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure
app.UIFigure = uifigure;
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'UI Figure';
app.UIFigure.CloseRequestFcn = createCallbackFcn(app, @UIFigureCloseRequest, true);
setAutoResize(app, app.UIFigure, true)
% Create GaugeLabel
app.GaugeLabel = uilabel(app.UIFigure);
app.GaugeLabel.HorizontalAlignment = 'center';
app.GaugeLabel.Position = [307 252 42 15];
app.GaugeLabel.Text = 'Gauge';
% Create Gauge
app.Gauge = uigauge(app.UIFigure, 'semicircular');
app.Gauge.Position = [268 282 120 65];
end
end
methods (Access = public)
% Construct app
function app = testapp()
% Create and configure components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
% Execute the startup function
runStartupFcn(app, @startupFcn)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!