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

Undocumented feature list

Posted By Yair Altman On March 19, 2014 | 4 Comments

Three years ago I posted an article on Matlab’s undocumented feature function [1]. feature is a Matlab function that enables access to undocumented internal Matlab functionality. Most of this functionality is not very useful, but in some cases it could indeed be very interesting. As sometimes happens, this innocent-enough article generated a lot of interest, both online and offline. Perhaps the reason was that in this article I listed the known list of supported features with a short explanation and references were available. At the time, this was the only comprehensive such listing, which I manually collected from numerous sources. For this reason I was delighted to receive Yves Piguet’s tip [2] about the availability of a programmatic interface for a full listing of features:

>> list = feature('list')   % 260 features in R2013b
list =
1x260 struct array with fields:

Which can be listed as follows:

for i = 1 : length(list)
   fprintf('%35s has_cb=%d has_bi=%d calls=%d val=%g\n', ...
      list(i).name, list(i).has_callback, list(i).has_builtin, list(i).call_count, list(i).value);
                    100 has_cb=0 has_bi=1 calls=0 val=1
                    102 has_cb=0 has_bi=1 calls=0 val=1
                     12 has_cb=0 has_bi=1 calls=0 val=1
                     14 has_cb=0 has_bi=1 calls=0 val=1
                     25 has_cb=0 has_bi=1 calls=0 val=1
                    300 has_cb=0 has_bi=0 calls=0 val=1
                    301 has_cb=0 has_bi=0 calls=0 val=1
                     44 has_cb=0 has_bi=1 calls=0 val=1
                     45 has_cb=0 has_bi=1 calls=0 val=1
                      7 has_cb=0 has_bi=0 calls=0 val=1
                      8 has_cb=0 has_bi=1 calls=0 val=1
                      9 has_cb=0 has_bi=0 calls=0 val=1
                  accel has_cb=0 has_bi=1 calls=0 val=0
         AccelBlockSize has_cb=0 has_bi=1 calls=0 val=0
          AccelMaxTemps has_cb=0 has_bi=1 calls=0 val=0
    AccelThreadBlockMin has_cb=0 has_bi=1 calls=0 val=0
              allCycles has_cb=0 has_bi=1 calls=0 val=0
 AllWarningsCanBeErrors has_cb=1 has_bi=0 calls=0 val=0
           ArrayEditing has_cb=0 has_bi=0 calls=0 val=1
       AutomationServer has_cb=0 has_bi=1 calls=0 val=0
              CachePath has_cb=0 has_bi=0 calls=0 val=1
     CaptureScreenCount has_cb=0 has_bi=0 calls=0 val=0
       CheckMallocClear has_cb=0 has_bi=0 calls=0 val=1
                    ... (etc. etc.)

Unfortunately, in the latest Matlab R2014a, which was released last week, this nice feature has been removed:

>> list = feature('list')
Error using feature
Feature list not found

Luckily, the list can still be retrieved programmatically, using an undocumented MEX library function. Place the following in a file called feature_list.cpp:

#include "mex.h"
void svListFeatures(int, mxArray_tag** const, int, mxArray_tag** const);
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])

Now compile this MEX file:

if isunix

As you can see, all this MEX function does is just call the svListFeatures() function from the libmwservices dynamic/shared library.
We can now run this MEX function directly in Matlab:

>> list = feature_list
list =
1x273 struct array with fields:

Running both the new feature_list and the previous feature(‘list’) on previous Matlab releases produces exactly the same result, showing that under the hood, feature(‘list’) was basically just calling libmwservices‘s svListFeatures() function.
There are 273 undocumented features in R2014a: 20 were added and 7 were removed compared to R2013b. For those interested, the modified features in the past two releases are:

  • R2013b:
    1. ConvertAllDoublesToHandles (added)
    2. DrawnowNowaitFeature (added)
    3. getsimd (added)
    4. CoreDump (removed)
  • R2014a:
    1. GPUAllowPartialSharedDataCopies (added)
    2. GPUAllowSharedDataCopies (added)
    3. GetOpenGLData (added)
    4. GetOpenGLInfo (added)
    5. HGUpdateErrorChecking (added)
    6. JVMShutdown (added)
    7. LoadHG1FigFileWithHG1Defaults (added)
    8. OpenGLBitmapZbufferBug (added)
    9. OpenGLClippedImageBug (added)
    10. OpenGLDockingBug (added)
    11. OpenGLEraseModeBug (added)
    12. OpenGLLineSmoothingBug (added)
    13. OpenGLPolygonOffsetBiasBug (added)
    14. OpenGLVerbose (added)
    15. OpenGLWobbleTesselatorBug (added)
    16. SaveFigFileWithHG1Defaults (added)
    17. ShutdownReportLevel (added)
    18. UseGenericOpenGL (added)
    19. crash_mode (added)
    20. isLightweightEval (added)
    21. EnableBangErrors (removed)
    22. EnableJavaAsGObject (removed)
    23. List (removed) – this is actually the reason for today’s article!
    24. hwtic (removed)
    25. hwtoc (removed)
    26. oldtictoc (removed)
    27. timing (removed)

Happy digging!

p.s. – Packt publishing, which publishes IT books, has a great deal on ebooks until March 26 – buy 1 get 1 free [3]. Some of their books are Matlab-related. Check it out!

Addendum July 18, 2016: Since R2015a, feature(‘list’) returns an empty array. A reader of this blog, Mikhail P, reported the following workaround, by temporarily setting the MWE_INSTALL environment variable (that should then be reset, since it is used in other locations too):

% The following was run in R2016b
>> setenv('MWE_INSTALL','1'); list = feature('list'), setenv('MWE_INSTALL');
list =
  1×266 struct array with fields:

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

4 Comments (Open | Close)

4 Comments To "Undocumented feature list"

#1 Comment By Eric On March 21, 2014 @ 09:39

Lots of new feature flags related to graphics, hopefully that’s a good sign for HG2 🙂

#2 Comment By Bastian Ebeling On July 8, 2016 @ 08:01

Hi Yair,

since R2016a the behaviour of feature(‘list’) is further special:

>> feature('list')
ans = 
1x0 struct array with fields:

Greets from Germany


#3 Comment By Yair Altman On July 8, 2016 @ 10:17

@Bastian – yes, nothing lasts forever…

One of the apparent drawbacks of publishing undocumented things on this blog is that it turns a spotlight on them, and then MathWorks has an incentive to close those loopholes/backdoors. This is why I keep the best stuff unpublished, like the undocumented function howToGetRichQuick – just kiddin’ 🙂

#4 Comment By Yair Altman On July 18, 2016 @ 21:18

@Bastian – I just updated the main text with a solution to this – [10].

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

URL to article: https://undocumentedmatlab.com/articles/undocumented-feature-list

URLs in this post:

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

[2] tip: http://undocumentedmatlab.com/blog/undocumented-feature-function/#comment-34109

[3] buy 1 get 1 free: http://bit.ly/1j26nPN

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

[5] The HotLinks feature : https://undocumentedmatlab.com/articles/the-hotlinks-feature

[6] Undocumented Profiler options part 4 : https://undocumentedmatlab.com/articles/undocumented-profiler-options-part-4

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

[8] Undocumented Matlab MEX API : https://undocumentedmatlab.com/articles/undocumented-matlab-mex-api

[9] Undocumented cursorbar object : https://undocumentedmatlab.com/articles/undocumented-cursorbar-object

[10] : https://undocumentedmatlab.com/blog/undocumented-feature-list#R2015a

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