Axes dot notation not available when used as property in (handle) classes (Matlab R2014b+)
Show older comments
I can easily initialize an array of 2 Axes:
a(2) = axes;
a(1) = axes;
And then, for example, modify the second Axes object:
a(2).XLim = [-2 2];
But the same functionality seems not to be available in classes:
classdef AxesTest < handle
properties
ax
end
methods
function this = AxesTest()
this.ax(2) = axes;
this.ax(1) = axes;
end
end
end
The ax property of the class is now a double array, as in earlier versions of Matlab:
a = AxesTest;
class(a.ax)
returns
ans =
double
Within classes, I have to use the old way of assigning new values to properties of Axes objects:
function makeYAxesEqual(this)
set(this.ax(1), 'YLim', get(this.ax(2), 'YLim'));
end
Is this an inconsistency of Matlab or is there a misunderstanding on my part?
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!