Well, I found a solution that works, although it feels a bit silly. Based on the discussion here, I also overloaded numArgumentsFromSubscript with its own builtin function (yeah...).
classdef dummyClass < handle
properties(SetAccess = protected)
caData
end
methods
function this = dummyClass(caData)
this.caData = caData;
end
function customFunction(this, data)
% <Code that operates on caData>
end
function varargout = subsref(this, s)
if strcmp(s(1).type, '()') && length(s) == 1
% User called this(ind). This works as intended
this.customFunction(this.caData{s.subs{1}})
else
% Use standard indexing for any other case
[varargout{1:nargout}] = builtin('subsref', this, s);
end
end % subsref()
function n = numArgumentsFromSubscript(obj, s, ic)
n = builtin('numArgumentsFromSubscript', obj, s, ic);
end
end
end
Now dummy.caData{:} works as exptected:
>> dummy.caData{:}
ans =
1 2 3
ans =
4 5 6
ans =
7 8 9
I'm leaving this question open for now though, just in case someone has a nicer solution that doesn't feel like a hack.