Linkdata plots with deployed applications

조회 수: 8 (최근 30일)
Alex
Alex 2024년 9월 19일
편집: Alex 2024년 9월 20일
I have a code which im looking to deploy using the matlab application compiler. My code involes a plot with linked data so i can have a live update of my output. The problem is that a plots cannot be linked in deployed applications because linked plots require the MATLAB workspace which is not available when code is deployed.
Are there ways around this or alternatives that i can use to keep the updating plots while havng my code deployable?

채택된 답변

Alex
Alex 2024년 9월 20일
편집: Alex 2024년 9월 20일
I found a workaround which is to use animated lines which do not directly reference the workspace so work even when passed through the application compiler.
timebase = -pi:0.01:(4*pi);
Display = figure('Name','Animated lines','NumberTitle','off');
h = animatedline(timebase,sin(timebase));
hold on
j = animatedline(timebase,sin(timebase));
ylim([-1 1]);
title('Title')
legend
hold off
for x=0:0.01:100
clearpoints(h)
clearpoints(j)
values2 = 0.5*sin(timebase+x);
values = sin(x)*values1;
addpoints(h,timebase,values)
addpoints(j,timebase,values2)
drawnow
end

추가 답변 (1개)

Taylor
Taylor 2024년 9월 19일
Is this what you're looking for? You can really see the behavior here, so copy, paste, and run the first section into your MATLAB, and then copy, paste, and run the second section to see how the plot updates.
x = 0:.1:4*pi;
y = sin(x);
figure;
h = plot(x, y);
h.XDataSource = "x";
h.YDataSource = "y";
y = cos(x);
refreshdata
Also, I don't think "The problem is that a plots cannot be linked in deployed applications because linked plots require the MATLAB workspace which is not available when code is deployed" is necessarily accurate. There is a workspace for compiled applications, you just don't really have direct access to it. linkdata is not supported for Compiler though.
  댓글 수: 1
Alex
Alex 2024년 9월 20일
Thank you for your help but that did not work i'm afraid. the line "Plots cannot be linked in deployed applications because linked plots require the MATLAB workspace" was the error message i got when i tried to run the code after compiling it using the application compiler. Im assuming this is part of the reason why linkdata is not supported by the compiler then.
I did find a workaround which is to use animated plots which do not reference the worspace directly and therfore work when compiled

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by