How can I display a patch in App Designer?
10 views (last 30 days)
Show older comments
Hey,
I don´t know how I can display a patch in App Designer.
the patch-function is within a function that I want to use in App Designer. If I run the function itself, there is no problem to display the figure, but it always displayed in a seperated window, not in the App designer window. I already tried to just add app.uiaxes to the axes, but it still is dispayed in a seperate windwo.
Can anyone help?
Thank you a lot!!
Here`s a part of the code
function StartModelButtonPushed(app, event)
Model = Load_model(1,0);
[~,num_model] = size(v);
figure;
% show each model
for num=1:num_model
n=v(num);
daspect([1 1 1]);
xticks([]);
yticks([]);
zticks([]);
axis on;
% patch model
p = patch('Faces',Model(n).FV.faces,'Vertices',Model(n).FV.vertices,'EdgeColor',Model(n).EdegeColor, 'FaceColor','red');
patch('Faces',Model(n).Sensor.SensorListe_save(6).VerticesListe);
pg= plot(uiaxes,p);
hold on;
end
end
0 Comments
Answers (1)
Raunak Gupta
on 16 Mar 2020
Hi,
From the question I see that you are using plot function while displaying the patch. Since patch support the axes parameters also you may directly plot the patch on the UIAxes. Here since the second patch command is not plotted on any previous axes, it is creating a new figure every time. If you plot the patch on given UIAxes, hold on command will not be required. Plotting a patch on UIAxes can be done as follows:
patch(uiaxes,'Faces',Model(n).FV.faces,'Vertices',Model(n).FV.vertices,'EdgeColor',Model(n).EdegeColor, 'FaceColor','red');
patch(uiaxes,'Faces',Model(n).Sensor.SensorListe_save(6).VerticesListe);
0 Comments
See Also
Categories
Find more on Polygons 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!