필터 지우기
필터 지우기

Send plots from matlab script to UIAxes in Appdesigner

조회 수: 27 (최근 30일)
Johannes Schütz
Johannes Schütz 2019년 5월 14일
편집: Ajay Kumar 2019년 10월 3일
Hello,
at the moment im working with Matlab App Designer, therefore I use a lot of Matlab Scripts which I programmed before. With Appdesigner I just made a GUI that it's easier to use all of them. The only thing I do is to open the different matlab scripts and run them when I push the Start Button. Everything works fine. My only problem is that I have a own Script which makes different plots depending on some adjustments. I don't want to program it in App Designer because than there would be a way to much code with if functions and I'm afraid that it's to confusing than and you get lost easily. With said Script I always get just one plot. And now I want to know how i can put this plot into a UIAxes from AppDesigner, because at the moment it always opens a own figure.
Following are some lines of this script for the plot.
I hope you can help me.
Whith best regards.
% Benötigte Koordinaten für Schulter mit Punkten hervorheben
if isequal(werte.config.Koerperteil,'Schulter')
if isequal(werte.config.Seite,'Rechts') || isequal(werte.config.Seite,'Links')
plot(RShoulder(1), RShoulder(2), 'y+', 'LineWidth', 2, 'MarkerSize', 15);
plot(Neck(1), Neck(2), 'y+', 'LineWidth', 2, 'MarkerSize', 15);
plot(LShoulder(1), LShoulder(2), 'y+', 'LineWidth', 2, 'MarkerSize', 15);
end
% Benötigte Koordinaten für Ellenbogen hervorheben
elseif isequal(werte.config.Koerperteil,'Ellenbogen')
if isequal(werte.config.Seite,'Rechts')
plot(RShoulder(1), RShoulder(2), 'y+', 'LineWidth', 2, 'MarkerSize', 15);
plot(RElbow(1), RElbow(2), 'y+', 'LineWidth', 2, 'MarkerSize', 15);
plot(RWrist(1), RWrist(2), 'y+', 'LineWidth', 2, 'MarkerSize', 15);
elseif isequal(werte.config.Seite,'Links')
plot(LShoulder(1), LShoulder(2), 'y+', 'LineWidth', 2, 'MarkerSize', 15);
plot(LElbow(1), LElbow(2), 'y+', 'LineWidth', 2, 'MarkerSize', 15);
plot(LWrist(1), LWrist(2), 'y+', 'LineWidth', 2, 'MarkerSize', 15);
end

채택된 답변

Ajay Kumar
Ajay Kumar 2019년 10월 3일
편집: Ajay Kumar 2019년 10월 3일
Try to create an axes in app designer using uiaxes. example: ax = uiaxes(....)
Then, when plotting pass this ax as first parameter to plot. example: plot(ax,......)
Now, the plot will not open a new figure, but it plots in the axes created in app designer.
doc plot
see example:
plot(ax,___) creates the line in the axes specified by ax instead of in the current axes (gca). The option ax can precede any of the input argument combinations in the previous syntaxes.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by