plot - Store MATLAB 3d viewport -
i using matlab display 3d data. use gui change view angle, zoom , pan. how can store view , later apply figure (containing more or less same data)? view
gives me matrix, how can apply figure?
thanks lot!
to use current view angle on figure, do:
% call when source axes current axes [az, el] = view; % call when target axes current axes view (az, el);
or, same using get
, set
of view
property.
however, apply view properties mentioned together, easier use matlab's built-in 'generate m file' option - when have 3d figure way want it, go file
->generate m-file
, , m-file created gets 3d data input, , apply settings.
another option save these relevant settings (just inspect m-file generated):
plot3(sin(t),cos(t),t); pba = get(gca, 'plotboxaspectratio'); dar = get(gca, 'dataaspectratio'); cva = get(gca, 'cameraviewangle'); cuv = get(gca, 'cameraupvector'); ct = get(gca, 'cameratarget'); cp = get(gca, 'cameraposition');
and apply current axes (assuming target axes current one):
set(gca, 'plotboxaspectratio',pba); set(gca, 'dataaspectratio',dar); set(gca, 'cameraviewangle',cva); set(gca, 'cameraupvector',cuv); set(gca, 'cameratarget',ct); set(gca, 'cameraposition',cp);
Comments
Post a Comment