Borrar filtros
Borrar filtros

view() not returning [az, el] ??

4 visualizaciones (últimos 30 días)
Ken
Ken el 26 de Abr. de 2024
Editada: Paul el 27 de Abr. de 2024
According to this documentation, I believe that the view function should be returning a two element vector [azimuth, elevation]. However, I observed that it actually returns a 4 x 4 projection matrix. But it won't take one! So what do I need to do to get something out of view that it will accept later, to restore the viewpoint?
Here is a command window view of actions taken at a couple of breakpoints in my program:
(Breakpoint, when graph is showing a 3D plot)
K>> a=view(graph)
a =
0.7934 -0.6088 0 -0.0923
0.3044 0.3967 0.8660 -0.7835
0.5272 0.6871 -0.5000 8.3031
0 0 0 1.0000
(Another breakpoint, when graph is showing a 2D plot)
K>> a=view(graph)
a =
1.0000 0 0 -0.5000
0 1.0000 0 -0.5000
0 0 -1.0000 9.1603
0 0 0 1.0000
K>> view(graph, a)
Error using view>ViewCore
Argument must be scalar, or two-vector.
Error in view (line 93)
ViewCore(hAxes, viewArgs{:});
  14 comentarios
Walter Roberson
Walter Roberson el 27 de Abr. de 2024
Based on the doc, the result of a single-output call to view is undefined (but the most likely result is the azimuth)
Paul
Paul el 27 de Abr. de 2024
Editada: Paul el 27 de Abr. de 2024
Why is it undefined?
According to Ignore Function Outputs, "... you can request only the first N outputs of a function (where N is less than or equal to the number of possible outputs) and ignore any remaining outputs." followed by examples to show exactly what that clause means.
The doc page for the very example on that doc page, which is fileparts, only shows a use with three outputs. Yet calling FILEPARTS with one output is not defined?

Iniciar sesión para comentar.

Respuestas (1)

Adam Danz
Adam Danz el 26 de Abr. de 2024
Editada: Adam Danz el 26 de Abr. de 2024
The azimuth and elevation outputs are returned as two separate outputs.
f = figure('visible','off');
ax = gca(f);
[az, el] = view(gca)
az = 0
el = 90
You discovered a little easter egg 😏
When only 1 output is requested, view returns a view matrix in a left handed coordinate system.

Categorías

Más información sobre Programming Utilities en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by