MATLAB Answers

Problem with "view" to save the orientation of a plot and then use it for another

31 views (last 30 days)
Marcos Belmonte
Marcos Belmonte on 22 Nov 2011
Hi, I'm trying to save the position of a plot in a subplot in order to plot the next with the same orientation (the code was performed already)
I tried with : orientation = view; % Its output is a 4 by 4 matrix. and then: view(orientation)
but I have an error in the second line I wrote: "Error using ==> view>ViewCore Argument must be scalar, or two-vector"
Could you help me, please?

  0 Comments

Sign in to comment.

Accepted Answer

Jan
Jan on 22 Nov 2011
In Matlab 2009a there was a 4x4 output and input for the view command:
view(T) sets the view according to the transformation matrix T,
which is a 4-by-4 matrix such as a perspective transformation
generated by viewmtx.
T = view returns the current 4-by-4 transformation matrix
In the documentation of the current release 2011b I do not find any hint about this feature anymore: doc view.
Of course the removing of this feature might be explained anywhere in the release notes or bugreports. But the best location for such changes and suggested workarounds would be the documentation.

  1 Comment

Marcos Belmonte
Marcos Belmonte on 23 Nov 2011
Hi, thanks very much for answering. Yes, I thought maybe it was for my version.
I have solved it with:
[az,el]=view;
and then:
view(az,el)
Thank you!

Sign in to comment.

More Answers (2)

rjarvinen
rjarvinen on 5 Mar 2012
Is there a way to store all camera settings in a variable and re-use them in several plots? Does the 4-by-4 matrix returned by the view function include all the camera and view information?
What I have done is to manually adjust the camera and view properties in the GUI for a single 3-D plot. Now I would like to save this configuration for easy later use to avoid doing this again for other similar plots.
view([az el]) is not enough since it does not include all the camera properties a user can adjust in the GUI.

  0 Comments

Sign in to comment.


Anton
Anton on 20 Mar 2012
very stupid to take away this backward compatibility! I had a script where the 4-by-4 matrix was stored in a variable A and the figure rotated with view(A) - fortunately it was always the same matrix (constant) and I simply changed the line to view(-46,44) to have an appropriate 3D-like view of my figure.
A= 1.0e+04*[ 0.4496 -0.4782 0.0000 0.0143
0.3244 0.2981 0.0000 -0.3113
0.3587 0.3298 -0.0000 4.2989
0 0 0 0.0001];
May be there is a simple way to transform this 4x4 matrix to the two angles, but it is very strange that 16 values were used instead of 2 befor and that there is no way to use this matrix directly now (you can still generate it with A=view)

  0 Comments

Sign in to comment.

Sign in to answer this question.