필터 지우기
필터 지우기

I'm trying to display a pdegplot graph in appdesigner, but I have no idea how to get it do display using app.UIAxes. My code is below

조회 수: 2 (최근 30일)
model = createpde;
gm = importGeometry(model,'ADCS.stl');
pdegplot(gm);

답변 (2개)

Cameron
Cameron 2022년 12월 30일
All you have to do is put your uiaxes as the first arguement. For you, it would likely just be pdegplot(app.UIAxes,gm). Here's another example
%the code below is taken from the documation here:
%https://www.mathworks.com/help/pde/ug/pdegplot.html?s_tid=doc_ta
g = [2 1 1 1 1 1 1 1 1 4 4;
-1 -0.6 -0.5 -0.4 -0.5 0.4 0.5 0.6 0.5 -1 0.17;
1 -0.5 -0.4 -0.5 -0.6 0.5 0.6 0.5 0.4 0.17 1;
0 -0.25 -0.35 -0.25 -0.15 -0.25 -0.35 -0.25 -0.15 0 -0.74;
0 -0.35 -0.25 -0.15 -0.25 -0.35 -0.25 -0.15 -0.25 -0.74 0;
0 0 0 0 0 0 0 0 0 1 1;
1 1 1 1 1 1 1 1 1 0 0;
0 -0.5 -0.5 -0.5 -0.5 0.5 0.5 0.5 0.5 0 0;
0 -0.25 -0.25 -0.25 -0.25 -0.25 -0.25 -0.25 -0.25 0 0;
0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 1 1;
0 0 0 0 0 0 0 0 0 0.75 0.75;
0 0 0 0 0 0 0 0 0 0 0];
pdegplot(app.UIAxes,g)
  댓글 수: 1
Mjganji
Mjganji 2023년 2월 15일
편집: Mjganji 2023년 2월 15일
I've got a syntax error with "pdegplot(app.UIAxes,g)" by:
Error using pdegplot
Expected a string scalar or character vector for the parameter name.
Is there any way to call a figure in app designer and then we write "pdegplot(g)" so it would draw in that specific figure? (like in script, "figure(F1)")

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


mi li
mi li 2023년 6월 6일
I find a solution,we can copy the date of pdegplot() to app.UIAxes:
pdegplot(model);%偏微分方程求解
hFig = gcf; % 获取当前图形窗口的句柄
hAx = gca; % 获取当前坐标系的句柄
% 复制绘图对象到 app.UIAxes
copyobj(allchild(hAx), app.UIAxes);
% ylim(app.UIAxes, [-80, 0]);
% xlim(app.UIAxes, [-80, 250]);
% zlim(app.UIAxes, [-80, 80]);
view(app.UIAxes,15,25);
% 关闭图形窗口
close(hFig);

Community Treasure Hunt

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

Start Hunting!

Translated by