MATLAB App Designer fetch data from .m file

조회 수: 8(최근 30일)
rohit 2020년 8월 27일
댓글: Mehmed Saad 2020년 8월 28일
I've a plot function in .m file. Can I plot the same figure inside App Designer with data being fetch from .m file continuously? How to achieve this?
For example, Suppose I've a test.m file and I want to plot it in App Designer.
function test
global T
T = figure(1);
hold all
for n=1:1:numel(x)
plot(x,y);axis([x(n) x(n+Dx) y1 y2]);
Or Is it only possible to have a button in App designer and on clicking it, pop up figures appears?

채택된 답변

Mehmed Saad
Mehmed Saad 2020년 8월 27일
편집: Mehmed Saad 2020년 8월 27일
if you call this function in app designer it will create an outside figure so you need to edit it a bit
You need to remove
T = figure(1)
hold all
add a UIAxes in you app
for hold on use
app.UIAxes.NextPlot = 'add';
Change this
app.UIAxes.XLim = [x(n) x(n+Dx)];
app.UIAxes.YLim = [y1 y2];
  댓글 수: 2
Mehmed Saad
Mehmed Saad 2020년 8월 28일
if you want to plot it inside the app designer figure, then you need to make changes
if you just want to open a new figure, just write m file name in some button callback or in startup function. remember m file which you are calling must be added to matlab path

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

추가 답변(0개)


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




Community Treasure Hunt

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

Start Hunting!

Translated by