App Designer Dataleak/Overflow
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graphics Object Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!