view() not returning [az, el] ??
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2024-4-27
Based on the doc, the result of a single-output call to view is undefined (but the most likely result is the azimuth)
Paul
2024-4-27
编辑:Paul
2024-4-27
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?
回答(1 个)
Adam Danz
2024-4-26
编辑:Adam Danz
2024-4-26
The azimuth and elevation outputs are returned as two separate outputs.
f = figure('visible','off');
ax = gca(f);
[az, el] = view(gca)
You discovered a little easter egg 😏
When only 1 output is requested, view returns a view matrix in a left handed coordinate system.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!