Undocumented Matlab
  • SERVICES
    • Consulting
    • Development
    • Training
    • Gallery
    • Testimonials
  • PRODUCTS
    • IQML: IQFeed-Matlab connector
    • IB-Matlab: InteractiveBrokers-Matlab connector
    • EODML: EODHistoricalData-Matlab connector
    • Webinars
  • BOOKS
    • Secrets of MATLAB-Java Programming
    • Accelerating MATLAB Performance
    • MATLAB Succinctly
  • ARTICLES
  • ABOUT
    • Policies
  • CONTACT
  • SERVICES
    • Consulting
    • Development
    • Training
    • Gallery
    • Testimonials
  • PRODUCTS
    • IQML: IQFeed-Matlab connector
    • IB-Matlab: InteractiveBrokers-Matlab connector
    • EODML: EODHistoricalData-Matlab connector
    • Webinars
  • BOOKS
    • Secrets of MATLAB-Java Programming
    • Accelerating MATLAB Performance
    • MATLAB Succinctly
  • ARTICLES
  • ABOUT
    • Policies
  • CONTACT

Undocumented feature list

March 19, 2014 4 Comments

Three years ago I posted an article on Matlab’s undocumented feature function. 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 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:
    name
    value
    has_callback
    has_builtin
    call_count

>> list = feature('list') % 260 features in R2013b list = 1x260 struct array with fields: name value has_callback has_builtin call_count

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);
end
                    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.)

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); end 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

>> 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[])
{
    svListFeatures(1,plhs,0,NULL);
}

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

Now compile this MEX file:

if isunix
   mex('feature_list.cpp',['-L',matlabroot,'/bin/',computer('arch')],'-lmwservices');
else
   mex('feature_list.cpp','-llibmwservices');
end

if isunix mex('feature_list.cpp',['-L',matlabroot,'/bin/',computer('arch')],'-lmwservices'); else mex('feature_list.cpp','-llibmwservices'); end

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:
    name
    value
    has_callback
    has_builtin
    call_count

>> list = feature_list list = 1x273 struct array with fields: name value has_callback has_builtin call_count

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. 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:
    name
    value
    has_callback
    has_builtin
    call_count

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

Related posts:

  1. Undocumented feature() function – Matlab's undocumented feature function enables access to some internal experimental features...
  2. The HotLinks feature – feature('HotLinks') can be used to temporarily disable hyperlinks and other markups in the Matlab console. ...
  3. Undocumented Profiler options part 4 – Several undocumented features of the Matlab Profiler can make it much more useful - part 4 of series. ...
  4. Legend '-DynamicLegend' semi-documented feature – The built-in Matlab legend function has a very useful semi-documented feature for automatic dynamic update, which is explained here....
  5. Undocumented Matlab MEX API – Matlab's MEX API contains numerous undocumented functions, that can be extremely useful. ...
  6. Undocumented cursorbar object – Matlab's internal undocumented graphics.cursorbar object can be used to present dynamic data-tip cross-hairs...
Mex Pure Matlab Undocumented function
Print Print
« Previous
Next »
4 Responses
  1. Eric March 21, 2014 at 09:39 Reply

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

  2. Bastian Ebeling July 8, 2016 at 08:01 Reply

    Hi Yair,

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

    >> feature('list')
    ans = 
    1x0 struct array with fields:
        name
        value
        has_callback
        has_builtin
        call_count

    >> feature('list') ans = 1x0 struct array with fields: name value has_callback has_builtin call_count

    Greets from Germany

    Bastian

    • Yair Altman July 8, 2016 at 10:17 Reply

      @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’ 🙂

      • Yair Altman July 18, 2016 at 21:18

        @Bastian – I just updated the main text with a solution to this – see here.

Leave a Reply
HTML tags such as <b> or <i> are accepted.
Wrap code fragments inside <pre lang="matlab"> tags, like this:
<pre lang="matlab">
a = magic(3);
disp(sum(a))
</pre>
I reserve the right to edit/delete comments (read the site policies).
Not all comments will be answered. You can always email me (altmany at gmail) for private consulting.

Click here to cancel reply.

Useful links
  •  Email Yair Altman
  •  Subscribe to new posts (feed)
  •  Subscribe to new posts (reader)
  •  Subscribe to comments (feed)
 
Accelerating MATLAB Performance book
Recent Posts

Speeding-up builtin Matlab functions – part 3

Improving graphics interactivity

Interesting Matlab puzzle – analysis

Interesting Matlab puzzle

Undocumented plot marker types

Matlab toolstrip – part 9 (popup figures)

Matlab toolstrip – part 8 (galleries)

Matlab toolstrip – part 7 (selection controls)

Matlab toolstrip – part 6 (complex controls)

Matlab toolstrip – part 5 (icons)

Matlab toolstrip – part 4 (control customization)

Reverting axes controls in figure toolbar

Matlab toolstrip – part 3 (basic customization)

Matlab toolstrip – part 2 (ToolGroup App)

Matlab toolstrip – part 1

Categories
  • Desktop (45)
  • Figure window (59)
  • Guest bloggers (65)
  • GUI (165)
  • Handle graphics (84)
  • Hidden property (42)
  • Icons (15)
  • Java (174)
  • Listeners (22)
  • Memory (16)
  • Mex (13)
  • Presumed future risk (394)
    • High risk of breaking in future versions (100)
    • Low risk of breaking in future versions (160)
    • Medium risk of breaking in future versions (136)
  • Public presentation (6)
  • Semi-documented feature (10)
  • Semi-documented function (35)
  • Stock Matlab function (140)
  • Toolbox (10)
  • UI controls (52)
  • Uncategorized (13)
  • Undocumented feature (217)
  • Undocumented function (37)
Tags
AppDesigner (9) Callbacks (31) Compiler (10) Desktop (38) Donn Shull (10) Editor (8) Figure (19) FindJObj (27) GUI (141) GUIDE (8) Handle graphics (78) HG2 (34) Hidden property (51) HTML (26) Icons (9) Internal component (39) Java (178) JavaFrame (20) JIDE (19) JMI (8) Listener (17) Malcolm Lidierth (8) MCOS (11) Memory (13) Menubar (9) Mex (14) Optical illusion (11) Performance (78) Profiler (9) Pure Matlab (187) schema (7) schema.class (8) schema.prop (18) Semi-documented feature (6) Semi-documented function (33) Toolbar (14) Toolstrip (13) uicontrol (37) uifigure (8) UIInspect (12) uitable (6) uitools (20) Undocumented feature (187) Undocumented function (37) Undocumented property (20)
Recent Comments
Contact us
Captcha image for Custom Contact Forms plugin. You must type the numbers shown in the image
Undocumented Matlab © 2009 - Yair Altman
This website and Octahedron Ltd. are not affiliated with The MathWorks Inc.; MATLAB® is a registered trademark of The MathWorks Inc.
Scroll to top