- Undocumented Matlab - https://undocumentedmatlab.com/blog_old -
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 [3]. 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 [4] 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
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.)
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[]) { 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
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
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:
Happy digging!
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
Categories: High risk of breaking in future versions, Mex, Undocumented function
Article printed from Undocumented Matlab: https://undocumentedmatlab.com/blog_old
URL to article: https://undocumentedmatlab.com/blog_old/undocumented-feature-list
URLs in this post:
[1] Image: https://undocumentedmatlab.com/feed/
[2] email feed: https://undocumentedmatlab.com/subscribe_email.html
[3] Matlab’s undocumented feature function: https://undocumentedmatlab.com/blog/undocumented-feature-function/
[4] tip: https://undocumentedmatlab.com/blog/undocumented-feature-function/#comment-34109
[5] buy 1 get 1 free: http://bit.ly/1j26nPN
[6] Serializing/deserializing Matlab data : https://undocumentedmatlab.com/blog_old/serializing-deserializing-matlab-data
[7] uiundo – Matlab’s undocumented undo/redo manager : https://undocumentedmatlab.com/blog_old/uiundo-matlab-undocumented-undo-redo-manager
[8] Matlab’s internal memory representation : https://undocumentedmatlab.com/blog_old/matlabs-internal-memory-representation
[9] Pinning annotations to graphs : https://undocumentedmatlab.com/blog_old/pinning-annotations-to-graphs
[10] Adding dynamic properties to graphic handles : https://undocumentedmatlab.com/blog_old/adding-dynamic-properties-to-graphic-handles
[11] MEX ctrl-c interrupt : https://undocumentedmatlab.com/blog_old/mex-ctrl-c-interrupt
[12] : https://undocumentedmatlab.com/blog/undocumented-feature-list#R2015a
Click here to print.
Copyright © Yair Altman - Undocumented Matlab. All rights reserved.
4 Comments To "Undocumented feature list"
#1 Comment By Eric On March 21, 2014 @ 9:39 am
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 @ 8:01 am
Hi Yair,
since R2016a the behaviour of feature(‘list’) is further special:
Greets from Germany
Bastian
#3 Comment By Yair Altman On July 8, 2016 @ 10:17 am
@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 @ 9:18 pm
@Bastian – I just updated the main text with a solution to this – [12].