I made a class that has methods to return specific slices of an n-d array. I can use these methods as if they are properties, and subindexing works with one exception, I can't index with just a colon, I have to enclose it in quotes.
Here are examples where normal indexing works:
>> foobar = cfoobar(reshape(1:8,2,2,2))
cfoobar with no properties.
>> foobar.foo([2,1],[2,1])
Here is the example that doesn't work:
Input arguments to function include colon operator. To input the colon character, use ':' instead.
Here is the example working with quotes:
Here is the class:
properties (Access = private)
function obj = cfoobar(data)
function data = foo(obj, varargin)
data = obj.foobar(:,:,1);
data = data(varargin{:});
function data = bar(obj, varargin)
data = obj.foobar(:,:,2);
data = data(varargin{:});
How do I write the class to make the colon work by itself?