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
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:
- R2013b:
- ConvertAllDoublesToHandles (added)
- DrawnowNowaitFeature (added)
- getsimd (added)
- CoreDump (removed)
- R2014a:
- GPUAllowPartialSharedDataCopies (added)
- GPUAllowSharedDataCopies (added)
- GetOpenGLData (added)
- GetOpenGLInfo (added)
- HGUpdateErrorChecking (added)
- JVMShutdown (added)
- LoadHG1FigFileWithHG1Defaults (added)
- OpenGLBitmapZbufferBug (added)
- OpenGLClippedImageBug (added)
- OpenGLDockingBug (added)
- OpenGLEraseModeBug (added)
- OpenGLLineSmoothingBug (added)
- OpenGLPolygonOffsetBiasBug (added)
- OpenGLVerbose (added)
- OpenGLWobbleTesselatorBug (added)
- SaveFigFileWithHG1Defaults (added)
- ShutdownReportLevel (added)
- UseGenericOpenGL (added)
- crash_mode (added)
- isLightweightEval (added)
- EnableBangErrors (removed)
- EnableJavaAsGObject (removed)
- List (removed) – this is actually the reason for today’s article!
- hwtic (removed)
- hwtoc (removed)
- oldtictoc (removed)
- timing (removed)
Happy digging!
Related posts:
- Undocumented feature() function Matlab's undocumented feature function enables access to some internal experimental features...
- 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....
- Types of undocumented Matlab aspects This article lists the different types of undocumented/unsupported/hidden aspects in Matlab...
- Undocumented Matlab MEX API Matlab's MEX API contains numerous undocumented functions, that can be extremely useful. ...