2

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?

Dev-iL
  • 23,742
  • 7
  • 57
  • 99
Eric
  • 95,302
  • 53
  • 242
  • 374
  • I think it has to be all caps `See also: CAT`. – mpaskov Mar 14 '17 at 14:32
  • @mpaskov: Nope, that does the same thing. Both produce a link, but in both cases the link goes to `matlab:help CatHelper/cat` – Eric Mar 14 '17 at 14:34
  • what about if you try to link to a completely different function e.g.`min`/`max`, just to make sure there is no name clash. – mpaskov Mar 14 '17 at 14:36
  • @mpaskov: Then that works fine. My issue here is specifically about resolving the name clash. I've updated my question title to make that clear – Eric Mar 14 '17 at 14:37
  • Thanks for clarification, it seems that you might have found the answer yourself. – mpaskov Mar 14 '17 at 15:21

2 Answers2

5

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);
Graham
  • 7,431
  • 18
  • 59
  • 84
Dev-iL
  • 23,742
  • 7
  • 57
  • 99
0

One slightly ugly workaround is to just include a direct link:

%   See Also: <a href="matlab:help cat">cat</a>
Eric
  • 95,302
  • 53
  • 242
  • 374