How to get the current Axes.View after using rotate3d interaction in MATLAB appdesigner?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm using MATLAB R2021b appdesigner to design a UI . And my request is that I want to get the current axes view (azimuth & elevation data) after rotating my plot via rotate3d interation tool using my mouse. I have checked the related documentation and found that the following code worked well in the script form:
function demo_mbd2
% Listen to rotate events
surf(peaks);
h = rotate3d;
h.ActionPreCallback = @myprecallback;
h.ActionPostCallback = @mypostcallback;
h.Enable = 'on';
function myprecallback(obj,evd)
disp('A rotation is about to occur.');
function mypostcallback(obj,evd)
newView = round(evd.Axes.View);
msgbox(sprintf('The new view is [%d %d].',newView));
However, I have no idea of how to embed it in the appdesigner environment. For example, I'm not aware of the right form of callback function - it seems none of the following trail worked:
function mypostcallback(app, obj, evd)
function mypostcallback(obj, evd)
function mypostcallback(app, evd)
I haven't learned so much about call back functions yet I'm in desperate need of solving this specific problem. Could anyone lend me a hand? Are there any feasible ways to use the previous codes, or do we have any other solutions?
Huge thanks!!!
0 comentarios
Respuestas (1)
Kevin Holly
el 1 de Sept. de 2022
Editada: Kevin Holly
el 1 de Sept. de 2022
Please see the attached app and scripts. I created a .m file for each callback function. Let me know if you have any questions.
Edit: Instead of pacing the message in the command window or message box, you could place it on a Label uicomponent.
app.Label.Text = "message";
Ver también
Categorías
Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!