Display pdeplot3D in Matlab App

5 次查看(过去 30 天)
Hello I want to display a pdeplot3D or a pdeplot in a Matlab App (using Matlab Appdesigner).
The Plot should be embedded in the main view and not be opend in a new Window.
To sum it up: I want to use the plot created by following command:
pdeplot3D(model,'ColorMapData',result.Stress.sxx,'Deformation',result.Displacement)
directly in Matlab Appdesigner.
The User should be able to make changes (e.q. change Boundary Conditions) and should see the newly generated plot in the App.
How can I achieve this?

采纳的回答

Kevin Holly
Kevin Holly 2022-4-1
编辑:Kevin Holly 2022-4-1
In App Designer you need to defined the Axes. It looks like pdeplot3D does not have an input for Axes - it generates one with the newplot command. Below is a work around.
model = createpde;
importGeometry(model,'Block.stl');
applyBoundaryCondition(model,'dirichlet','Face',[1:4],'u',0);
specifyCoefficients(model,'m',0,'d',0,'c',1,'a',0,'f',2);
generateMesh(model);
results = solvepde(model);
u = results.NodalSolution;
h = pdeplot3D(model,'ColorMapData',u);
h(2).Parent = app.UIAxes;
view(app.UIAxes,45,45)
colorbar(app.UIAxes)
close(h(1).Parent)
axis(app.UIAxes,'off')
Edit: This one would be more simliar to yours since you had a transform (notice you need to change the parent of the parent of the handle rather than just the parent of the handle due to the transform).
structuralmodel = createpde('structural','static-solid');
importGeometry(structuralmodel,'SquareBeam.stl');
structuralProperties(structuralmodel,'PoissonsRatio',0.3, ...
'YoungsModulus',210E3);
structuralBC(structuralmodel,'Face',6,'Constraint','fixed');
structuralBoundaryLoad(structuralmodel,'Face',5, ...
'SurfaceTraction', ...
[0;0;-2]);
generateMesh(structuralmodel);
structuralresults = solve(structuralmodel);
figure
h = pdeplot3D(structuralmodel, ...
'ColorMapData',structuralresults.VonMisesStress, ...
'Deformation',structuralresults.Displacement)
h(2).Parent.Parent = app.UIAxes;
view(app.UIAxes2,45,45)
colorbar(app.UIAxes)
close(h(1).Parent)
axis(app.UIAxes,'off')
  2 个评论
Marco Mader Mendes
Thank you a lot for your help!
The Solution is just what I was looking for!
Thanks!
xiaoli
xiaoli 2024-1-24
Thanks!
I also meet the same problem

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by