Search code examples
matlabclassdocumentationshadowingtoken-name-resolution

Resolving name clashes with builtins in a see also documentation section


I have the following class, with a method that hides (or shadows) a builtin function. I want the documentation to contain a "See Also" section, that links to the builtin function that is hidden.

classdef CatHelper
  %CATHELPER Makes implementing vertcat/horzcat easy on a custom class
  %
  %   See Also: cat

  methods (Abstract)
    obj = cat(obj, ndim, varargin);
  end
end

Unfortunately, the "see also" link just tries to give help on the undocumented abstract method CatHelper/cat.

How do I specify that I want the link to go to the builtin cat function?


Solution

  • After playing around a bit with doc.m\resolveTopic(), I came up with the three options as shown below. The top one (\cat) gives the best result, but you should use whichever you feel is the least ambiguous in your case.

    %   See Also: \cat
    %   See Also: elmat\cat
    %   See Also: matlab\elmat\cat
    

    These were found by passing topic = 'cat' into:

    matlab.internal.language.introspective.resolveName(topic, '', false);