필터 지우기
필터 지우기

3D plot in appdesigner

조회 수: 93 (최근 30일)
Ni2
Ni2 2019년 10월 25일
댓글: Ke Wei Ong 2020년 8월 23일
why do i get 2D plot instead of 3D
function startupFcn(app)
cla (app.UIAxes,'reset')
hold (app.UIAxes,'on')
Pi = [0,0,0];
Pii = [4,1,0];
Piii = [1,4,0];
Piv = [1,1,3];
Pv = [1,1,0];
pts0 = [Pi;Pii];
pts1 = [Pi;Piii];
pts2 = [Pii;Piii];
pts3 = [Piv;Pv];
plot3(app.UIAxes,pts0(:,1),pts0(:,2),pts0(:,3),'Color','b')
plot3(app.UIAxes,pts1(:,1),pts1(:,2),pts1(:,3),'Color','b')
plot3(app.UIAxes,pts2(:,1),pts2(:,2),pts2(:,3),'Color','b')
plot3(app.UIAxes,pts3(:,1),pts3(:,2),pts3(:,3),'Color','r')
xlabel(app.UIAxes,'length');
ylabel(app.UIAxes,'width');
zlabel(app.UIAxes,'height');
end

채택된 답변

Hope Q
Hope Q 2019년 10월 25일
Use the view command to set the perspective on the axes.
For example:
view(app.UIAxes,[-5 2 5])
  댓글 수: 3
Abdulrasheed Afolabi
Abdulrasheed Afolabi 2020년 5월 6일
편집: Abdulrasheed Afolabi 2020년 5월 6일
Thanks, it's a life saver.
Ke Wei Ong
Ke Wei Ong 2020년 8월 23일
Hi Ni2, did you find a way to plot without another pop-up window?

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

추가 답변 (1개)

Hope Q
Hope Q 2019년 10월 25일
What version are you using?
I'm using R2019b Update 1 on 64-bit Windows.
I pasted your code into a new blank App with one UIaxes.
I added the line
view(app.UIAxes,[5 2 5])
as the last line in the startupFcn. The 3D plot was in the UIAxes as expected.
3Dplot.png
  댓글 수: 2
Ni2
Ni2 2019년 10월 25일
편집: Ni2 2019년 10월 25일
Mine is 2018a on 64-bit windows and the output is unexpected.
Ni2
Ni2 2019년 10월 26일
I just noticed mine one also work fine with view command in a single window app.
But my app is a sub app.

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

카테고리

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