How do I link the 'ZLim' and 'CLim' properties of an axes together in MATLAB 7.9 (R2009b)?

3 views (last 30 days)
I would like to update the 'CLim' property of my axes, whenever the 'ZLim' property of the same axes changes.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 9 Dec 2010
It is possible to use the ADDLISTENER function to execute a function whenever the 'ZLim' property is updated.
a = axes;
surf(peaks);
view(2);
l = addlistener(a, 'ZLim', 'PostSet', @(src, evt) set(a, 'CLim', get(a, 'ZLim')));
Now while the listener 'l' is valid updates to the 'ZLim' property of the axes will cause a corresponding change to the 'CLim' property. The following statement cancels the automatic updates:
delete(l);
Note that the LINKPROP and LINKAXES functions are inapplicable in this situation since those functions are for linking the SAME property of DIFFERENT objects, whereas here we would like to link DIFFERENT properties of the SAME object.

More Answers (0)

Categories

Find more on Visual Exploration in Help Center and File Exchange

Products


Release

R2009b

Community Treasure Hunt

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

Start Hunting!