- Undocumented Matlab - https://undocumentedmatlab.com -

The HotLinks feature

Posted By Yair Altman On October 24, 2017 | 1 Comment

Back in 2010, I posted about Matlab’s undocumented feature function [1]. One of the features that I mentioned was 'HotLinks'. A few days ago I had an occasion to remember this feature when a StackOverflow user complained [2] that the headers of table outputs in the Matlab console appear with HTML tags (<strong>) in his diary output. He asked whether it was possible to turn off this automated headers markup.
There are several ways this problem can be solved, ranging from creating a custom table display function, to modifying the table’s internal disp method (%matlabroot%/toolbox/matlab/datatypes/@tabular/disp.m), to using this method’s second optional argument (disp(myTable,false)). Note that simply subclassing the table class to overload disp() will not work because the table class is Sealed, but we could instead subclass table‘s superclass (tabular) just like table does.
Inside the disp.m method mentioned above, the headers markup is controlled (around line 45, depending on your Matlab release) by matlab.internal.display.isHot. Unfortunately, there is no corresponding setHot() method, nor corresponding m- or p-code that can be inspected. But the term “Hot” rang a bell, and then I remembered my old post about the HotLinks feature, which is apparently reflected by matlab.internal.display.isHot.

feature('HotLinks',false);  % temporarily disable bold headers and hyperlinks (matlab.internal.display.isHot=false)
disp(myTable)
myTable        % this calls disp() implicitly
feature('HotLinks',true);   % restore the standard behavior (markup displayed, matlab.internal.display.isHot=true)

Searching for “isHot” or “HotLinks” under the Matlab installation folder, we find that this feature is used in hundreds of places (the exact number depends on your installed toolboxes). The general use appears to be to disable/enable output of hyperlinks to the Matlab console, such as when you display a Matlab class, when its class name is hyperlinked and so is the “Show all properties” message at the bottom. But in certain cases, such as for the table output above, the feature is also used to determine other types of markup (bold headers in this case).

>> feature('HotLinks',0)  % temporarily disable bold headers and hyperlinks
>> groot
ans =
  Graphics Root with properties:
 
          CurrentFigure: [0×0 GraphicsPlaceholder]
    ScreenPixelsPerInch: 96
             ScreenSize: [1 1 1366 768]
       MonitorPositions: [2×4 double]
                  Units: 'pixels'
 
  Use GET to show all properties
>> feature('HotLinks',1)  % restore the standard behavior (markup displayed)
>> groot
ans =
  Graphics Root with properties:
 
          CurrentFigure: [0×0 GraphicsPlaceholder]
    ScreenPixelsPerInch: 96
             ScreenSize: [1 1 1366 768]
       MonitorPositions: [2×4 double]
                  Units: 'pixels'
 
  Show all properties

There’s nothing really earth shuttering in all this, but the HotLinks feature could be useful when outputting console output into a diary file. Of course, if diary would have automatically stripped away markup tags we would not need to resort to such hackery. Then again, this is not the only problem with diary, which is long-overdue an overhaul [3].

Categories: Desktop, High risk of breaking in future versions, Undocumented feature, Undocumented function


1 Comment (Open | Close)

1 Comment To "The HotLinks feature"

#1 Comment By Riya Sharma On October 30, 2017 @ 08:25

Thanks for sharing such an informative blog. This blog provides information about the function in MATLAB which will be very useful to others. Great blog with proper information with example.


Article printed from Undocumented Matlab: https://undocumentedmatlab.com

URL to article: https://undocumentedmatlab.com/articles/the-hotlinks-feature

URLs in this post:

[1] Matlab’s undocumented feature function: http://undocumentedmatlab.com/blog/undocumented-feature-function

[2] StackOverflow user complained: https://stackoverflow.com/questions/46676035/how-do-i-change-the-fontweight-of-table-titles-in-matlab

[3] long-overdue an overhaul: http://undocumentedmatlab.com/blog/couple-of-matlab-bugs-and-workarounds#comment-340803

[4] Undocumented feature() function : https://undocumentedmatlab.com/articles/undocumented-feature-function

[5] Undocumented feature list : https://undocumentedmatlab.com/articles/undocumented-feature-list

[6] Legend '-DynamicLegend' semi-documented feature : https://undocumentedmatlab.com/articles/legend-semi-documented-feature

[7] Creating a simple UDD class : https://undocumentedmatlab.com/articles/creating-a-simple-udd-class

[8] Types of undocumented Matlab aspects : https://undocumentedmatlab.com/articles/types-of-undocumented-matlab-aspects

[9] Matlab's HG2 mechanism : https://undocumentedmatlab.com/articles/matlab-hg2

Copyright © Yair Altman - Undocumented Matlab. All rights reserved.