Plot 2D vector in AppDesigner

Hello there!
I'd like to use the command vplot in MATLAB AppDesigner, but it doesn't work.
Is it possible to use it? or is there any other option to plot a vector in 2D in AppDesigner?

답변 (1개)

Austin M. Weber
Austin M. Weber 2024년 2월 8일

0 개 추천

I could not get the vplot function to work, but there is always quiver.
For instance, if you add a button to your app and give it a callback function you can give it the following commands:
load wind
quiver(app.UIAxes,x(:,:,7),y(:,:,7),u(:,:,7),v(:,:,7));
ylim(app.UIAxes,[30 50])
xlim(app.UIAxes,[85 115])
This will produce a nice 2D vector plot in the app designer (assuming that you already have a UIAxes pane with the name UIAxes in the app):

댓글 수: 4

Alberto
Alberto 2024년 2월 8일
Is quiver useful to plot a single vector instead of a vector field?
You can certainly do that. Just specify the x and y coordinate where you want the vector arrow to start, then specify the magnitude of the vector in the u (horizontal) and v (vertical) directions. For example:
x = 0;
y = 0;
u = 1;
v = 2;
q = quiver(x,y,u,v,'r','LineWidth',2); % In the App Designer: quiver(app.UIAxes,...)
xlim([-3 3]) % In the App Designer: xlim(app.UIAxes,[-3 3])
ylim([-3 3]) % In the App Designer: ylim(app.UIAxes,[-3 3])
Alberto
Alberto 2024년 2월 8일
Thanks a lot, sir! Really useful
Austin M. Weber
Austin M. Weber 2024년 2월 10일
@Alberto Happy to help! If the solution is working for you then you should click the green button to accept the answer.

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

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품

릴리스

R2023b

질문:

2024년 2월 8일

댓글:

2024년 2월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by