Slow plotting in App Designer

6 ビュー (過去 30 日間)
Izan Segarra
Izan Segarra 2019 年 4 月 19 日
回答済み: Eric Delgado 2022 年 9 月 20 日
Hello! I am measuring signals in real time and I need to represent the signal in a graph. When I use datetick, the graph becomes very slow.
Is there any way to represent the real time signal in a efficient way?
h1 = animatedline(app.UIAxes,nan,nan,'Color','b','LineWidth',1.5);
app.UIAxes.YGrid = 'on';
startTime = datetime('now');
while ~app.stopLoop
serialRead = fscanf(arduino,'%d');
voltage = serialRead*(1100/1023);
y = bandpass(app,voltage);
t = datetime('now') - startTime;
% Add actual measurement
addpoints(h1,datenum(t),y);
% Update Axis
app.UIAxes.XLim = datenum([t-seconds(15) t]);
datetick(app.UIAxes,'x','keeplimits')
drawnow limitrate
end

回答 (1 件)

Eric Delgado
Eric Delgado 2022 年 9 月 20 日
Yeah. The interactivity in this new universe of uifigure is still too slow. The simple solution is to use de old Matlab figure. Don't forget to create properties in your app to handle the figure and the axes.
You could do something like this...
% Declare two new properties of your app.
properties (Access = public)
fig = [];
ax = [];
% Create a function and call it during the startup of the app.
function startup_figCreation(app)
app.fig = figure;
app.ax = axes(app.fig);
end

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by