App Designer Dataleak/Overflow
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Dylan Tarter
el 12 de Feb. de 2020
Respondida: Dylan Tarter
el 13 de Feb. de 2020
I've been working on an appdesigner project which requires constant polling of data and displaying the most recent values on a scrolling graph. I have accomplished this using the attached code, but the problem is as T->inf it becomes slower and laggier. I've double checked and the X and data arrays should stay consistently the same size so as time goes on the values of say X should change but never actually contain more than say 100 values. Maybe the implementation causes some sort of dataleak and its not getting rid of what is left over. Any insight would be appreciated.
For the code: new_V1/I1 and dataX are both initialized as empty arrays. The value coming is can change depending on what is inputted. Max Scroll is 10
function results = pollOutput(app)
%% get new data
new_V1 = app.VoltagekVEditField.Value;
new_I1 = app.CurrentmAEditField.Value;
%% update labels
app.XkVLabel.Text = strcat(num2str(new_V1),'kV');
app.XmALabel.Text = strcat(num2str(new_I1),'mA');
%% append new values to data display arrays
xl = length(app.dataX);
mxs = app.maxScroll;
if(xl > 0 && xl < mxs)
%disp('load');
app.dataX = [app.dataX app.dataX(xl)+1];
app.dataV1 = [app.dataV1 new_V1];
app.dataI1 = [app.dataI1 new_I1];
elseif(xl >= mxs)
%disp('scroll');
app.dataX = [app.dataX(end-mxs+1:end) app.dataX(xl)+1];
app.dataV1 = [app.dataV1(end-mxs+1:end) new_V1];
app.dataI1 = [app.dataI1(end-mxs+1:end) new_I1];
xlim(app.UIAxes,[app.dataX(1),app.dataX(end)]);
else
%disp('init');
app.dataX = 1;
app.dataV1 = [app.dataV1 new_V1];
app.dataI1 = [app.dataI1 new_I1];
end
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!