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

Undocumented feature() function

Posted By Yair Altman On May 4, 2010 | 27 Comments

Taking a short break from Java-related stuff in Matlab, I wanted to share and expand a reply I posted [1] a short while ago on the StackOverflow forum, in response to a reader’s request to explain Matlab’s feature function. This article uses pure Matlab and is absolutely unrelated to Java, so those of you who are Java-phobic can be at ease trying this at home…
feature is an entirely undocumented and unsupported Matlab function, and unlike most other undocumented Matlab functions it actually does often change without prior notice between Matlab releases, so be very careful when using this function in your code.
feature accepts two arguments: the name of the feature and an optional new value. This is similar to get/set functions: When only one argument is supplied, Matlab returns the current feature value (like get), otherwise the value is modified (like set). In some rare cases (feature(‘timing’)), a third input argument is sometimes expected.
Feature names are case-insensitive. The built-in function system_dependent appears to be a synonym for feature (not exactly – some system_dependent features are unavailable in feature…). We can find several references to system_dependent online, mostly for old Matlab releases. There’s even an entry in the official Matlab FAQ [2] (which has no usful info), and I’ve seen online references [3] going all the way back to 1993…
One of the very rare official comments about this function says [4]:

The system_dependent function is an unpublished function that we use for a variety of crufty things. It will most certainly change from time to time and possibly even go away completely. The system_dependent function performs different functionality on each of the platforms supported by MATLAB.

Several feature options have been reported over the years, mainly on the CSSM forum and also seen in the installed Matlab code base, as listed below (the code references are from the latest Matlab release – 7.10, aka R2010a). Note that many of these features may not work on your platform:

  • feature(‘usehg2’,flag) – this apparently relates to a new Handle-Graphics implementation that is under development for the past few years (I think I saw references to HG2 as far back as 2007, possibly earlier). HG2 is automatically active when Matlab is started with -hgVersion 2 option. It appears that the numeric HG handles have been replaced with their object-oriented (Matlab class system) handle counterparts in HG2 (today these class-system handles can be gotten using the handle function). Some handle properties are not implemented in HG2, and some GUI elements appear missing (figure menubar and toolbar, for example), but the basic plots look similar to our familiar HG. If anyone has any further information about HG2 I would love to hear it…
  • feature(‘useGBT2’) – “feature(‘useGBT2’) is only available when Matlab is started with -hgVersion 2 option.” – In /ja/xlate:15419; also see in: clf.m
  • feature(‘HGUsingMatlabClasses’) – see hgrc.m, subplot.m, title.m, xlabel.m, ylabel.m, zlabel.m, mesh.m, surf.m, colorbar.m etc. etc.
  • feature(‘JavaFigures’) – see propedit.m; disabled since R2007a [5] when native (non-Java) Matlab figures were disabled.
  • feature(‘UseJava’) – see usejava.m
  • feature(‘ClearJava’,1) – see javaclasspath.m
  • feature(‘SetPrecision’) – accepts [6] values 24, 53 or 64
  • feature(‘SetRound’) – accepts [6] values 0, 0.5, Inf or -Inf
  • feature(‘IsDebug’) – see here [7]; controls Matlab assertions.
  • feature(‘NewPrintAPI’) – see \toolbox\matlab\graphics\private\setup.m
  • feature(‘accel’,’on/off’) – see here [8] and here [9]. There is also a related feature(‘JIT’,’on/off’) which appears [7] to control a subset of feature(‘accel’).
  • feature(‘GetOS’) – see ver.m
  • feature(‘GetWinSys’) – see ver.m
  • feature(‘GetPid’) – returns the Matlab process ID [10] (well, actually the PID of its JVM but that’s the same PID as Matlab’s). Also see the similar java.lang.management.ManagementFactory.getRuntimeMXBean.getName.char. This latter function returns the PID mangled with the computer name (for example: ‘1234@My-desktop’).
  • feature(‘GetCPU’) – see daqsupport.m (Data Acquisition Toolbox) and here [7]
  • feature(‘NumCores’) – returns the number of CPU cores [11] seen by Matlab
  • feature(‘NumThreads’) – see here [7]
  • feature(‘MemStats’), feature(‘DumpMem’), feature(‘ProcessMem’) – these are memory reports that are even recommended by official MathWorks tech notes (1 [12],2 [13]), newsletter [14] and technical solutions (1 [15],2 [16]). Numerous references to these features can be found online [17].
  • feature(‘CheckMallocMemoryUsage’) – see this official technical paper [18]
  • feature(‘CheckMallocHeapWalk’) – see here [19]
  • feature(‘ShowCommandWindow’) – see here [20] = commandwindow
  • feature(‘LogDir’) – see here [21] = tempdir
  • feature(‘HotLinks’) – used to disable hyperlinks in the Command Window. This is used by Word notebooks (see mwMatlabEval macro in the Microsoft Word template file %matlabroot%\notebook\pc\M-BOOK.DOT). Also see: info.m, mlint.m, doclink.m, guidefunc.m, displayEndOfDemoMessage.m
  • feature(‘UseOldFileDialogs’) – see toolbox\matlab\uitools\private\usejavadialog.m
  • feature(‘timing’) – For example: cpucount = feature(‘timing’,’cpucount’); There are several other 2nd arg options, as explained by the following informative error message:
    >> feature timing
    ??? Error using ==> feature
    Choose second argument from:
      'resolution_tictoc'  - Resolution of Tic/Toc clock in sec (double)
      'overhead_tictoc'    - Overhead of Tic/Toc command in sec (double)
      'cpucount'           - Current CPU cycles used (uint64) [Using utCPUcount]
      'getcpuspeed_tictoc' - Stored CPU cycles/sec (double) [Used by tic/toc]
      'cpuspeed'           - Current CPU cycles/sec (double) [Simple MathWorks]
      'winperfcount'       - Current CPU cycles used (uint64) [Windows call]
      'winperfspeed'       - Current CPU cycles/sec (double) [Windows call]
      'wintime'            - Current Windows time (uint32) [Windows call]
                             units: msec since startup [Wraps]
      'wintimeofday'       - Current time of day converted to file time (unit64)[Windows call]
                             units: 100 nsec since 01-Jan-1601 (UTC)
      'clocks_per_sec'     - clock() speed in cycles/sec [CLOCKS_PER_SEC]
    Choose second and third arguments from:
      'cpuspeed', double num             - Current CPU cycles/sec (double) [MathWorks - num iterations]
      'setcpuspeed_tictoc', double speed - Set the CPU cycles/sec [Used by tic/toc]
       uint64 arg2, uint64 arg3          - uint64 difference = arg2 - arg3 (uint64)
  • feature(‘memtic’), feature(‘memtoc’) – possibly related to feature(‘timing’); mentioned in /ja/xlate:5780-5781
  • feature(‘locale’) – see mlint.m, mtree.m, helpmenufcn.m
  • feature(‘DefaultCharacterSet’) – see here [22]
  • feature(‘COM_SafeArraySingleDim’) – explained here [23] and here [24].
  • feature(‘COM_ActxProgidCheck’,flag) – see /help/techdoc/helpsearch/_533.cfs
  • feature(‘FigureTools’) – see domymenu.m
  • feature(‘TimeSeriesTools’,1) – see /help/techdoc/helpsearch/_533.cfs
  • feature(‘launch_activation’, ‘forcecheck’) – see StudentActivationStatus.m
  • feature(‘EightyColumns’,flag) – see matlabrc.m
  • feature(‘GetSharedLibExt’) – see loadlibrary.m and /toolbox/matlab/audiovideo/private/privateMMReaderPluginSearch.m
  • feature(‘GetDefaultPrinter’) – see printdlg.m, printopt.m
  • feature(‘GetPrinterInfo’) – see pagesetupdlg.m
  • feature(‘GetPrinterColor’) – see /toolbox/matlab/graphics/private/defaultprtcolor.m
  • feature(‘GetSpecifiedPrinterPort’,printerName) – see /toolbox/matlab/graphics/private/send.m
  • feature(‘ShowFigureWindows’) – see printjob.m, printtables.m, /toolbox/matlab/graphics/private/warnfiguredialog.m
  • feature(‘SearchUDDClassesForHelp’) – see /toolbox/matlab/helptools/+helpUtils/@HelpProcess/getHelpText.m
  • feature(‘AutomationServer’) – see notebook.m, enableservice.m = enableservice(‘AutomationServer’, true)
  • feature(‘EnableDDE’,flag) – see enableservice.m = enableservice(‘DDEServer’, true)
  • feature(‘GetUserWorkFolder’) – see userpath.m, savepath.m
  • feature(‘DirsAddedFreeze’), feature(‘DirsAddedUnfreeze’) – see addpath.m
  • feature(‘ToolboxFreeze’), feature(‘ToolboxUnfreeze’) – explained here [4]
  • feature(‘DirChangeHandleWarn’) – accepts ‘always’, ‘once’, ‘never’ or ‘status’. Mentioned in an official Matlab technical solution [25] and also in changeNotificationAdvanced.m.
  • feature(‘DirReloadMsg’) – accepts ‘on’, ‘off’ or ‘status’. See changeNotificationAdvanced.m and here [4].
  • feature(‘RemoteCWDPolicy’) – accepts ‘Reload’, ‘TimecheckDir’, ‘TimecheckDirFile’, ‘TimecheckFile, ‘None’ or ‘status’. See changeNotification.m and here [4].
  • feature(‘RemotePathPolicy’) – accepts ‘Reload’, ‘TimecheckDir’, ‘TimecheckDirFile’, ‘TimecheckFile, ‘None’ or ‘status’. See changeNotification.m, here [4] and this official technical solution [26].
  • feature(‘GetPref’,prefName) – returns the system preference value for the requested preference name in the global prefs file ([prefdir,’/matlab.prf’]) that is explained here [27].
  • feature(‘IsDebugMode’) – mentioned here [28] and several other online places
  • feature(‘ForceFramesOnBottom’) – mentioned here [29]

Oddly, some features are only accessible via system_dependent, and not via feature:

  • system_dependent(‘builtinEditor’,flag) – see matlabrc.m
  • system_dependent(‘miedit’,filename) – referenced here [30], here [31] and in edit.m. See matlabrc.m.
  • system_dependent(4,…) – See cedit.m, arrayviewfunc.m, dbmex.m, mexdebug.m. In addition to 4, I have seen references to features #2, 7-14, 44, 45, 1000-1003.
  • system_dependent(12,flag) – See %matlabroot%\notebook\pc\M-BOOK.DOT macro InitFromSavedSettings.

The following are OpenGL [32]-related features that are used in the opengl.m function:

  • feature(‘OpenglMode’)
  • feature(‘OpenGLLoadStatus’)
  • feature(‘UseMesaSoftwareOpenGL’,1)- unix only
  • feature(‘UseGenericOpengl’,1)
  • feature(‘GetOpenglInfo’) = opengl(‘info’)
  • feature(‘GetOpenglData’) = opengl(‘data’)
  • feature(‘OpenGLVerbose’,1)

If you lasted this far you deserve a special treat: Last but not least we have feature(‘dwim’) [33]. Unfortunately, this feature sometimes fails on some systems…
Have you discovered or used any interesting feature? If so, please do share them in the comments section below

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

27 Comments (Open | Close)

27 Comments To "Undocumented feature() function"

#1 Comment By Donn Shull On May 4, 2010 @ 10:02

Hi Yair, the following feature is only useful to people with Simulink and Real-Time Workshop Embedded Coder. If you open a block diagram for example:

>> rtwdemo_fuelsys

you can obtain the object instance for your block diagram with:

>> obj = get_param(bdroot, 'UDDObject')

This object has a lot of useful methods but many of them raise an exception for example:

>> obj.getCompiledBlockList
??? Simulink engine interface is not enabled.

Using the engine interface feature will enable those methods

>> feature('EngineInterface', 1)

Will enable those methods.

On a related topic as an alternative to using handle to obtain the object for handle graphics items you can create them with a “package qualified” command and they will return the object rather than a numeric handle. for example:

>> figObj = hg.figure
figObj =

Thanks for all the hard work,


#2 Comment By walderich On August 27, 2014 @ 00:42

Thanks a lot for the “EngineInterface” feature. But in my case I had to set its value to 1001 to get it working. I tested this with Matlab versions R2010b-R2014a.

#3 Comment By Ondrej Konopka On July 17, 2010 @ 03:47

Hi Yair, I found out additional features in R2008b. Meanings of features are obvious from names of features in case of features with capital letters. The rest of features i have no idea what it does.


Hopefully, it helps you improve these pages. Thanks for the hard work as well.


#4 Comment By Yves Piguet On February 18, 2011 @ 06:01

Is this one known?

feature list


l = feature('list');
for i = 1:length(l)
  fprintf('%35s has_cb=%d has_bi=%d calls=%d val=%g\n', ...
    l(i).name, l(i).has_callback, l(i).has_builtin, l(i).call_count, l(i).value);

#5 Comment By Yair Altman On February 18, 2011 @ 06:40

@Yves – this is fantastic 🙂

#6 Comment By Aurélien On April 11, 2011 @ 00:29

Reading this bug report this morning : MATLAB crashes during debugging
I discovered other feature commands and of cours I immediately think about sharing this on your blog :

1. Turn off the JIT in the offending program file using the command “feature scopedAccelEnablement off”.
2. Turn off the jitting of structures using the command “feature jitallow structs off”.
3. Turn off the JIT completely using the command “feature accel off”

#7 Comment By Yair Altman On April 11, 2011 @ 05:53

Thanks for the tip, Aurélien 🙂

#8 Pingback By Converting Java vectors to Matlab arrays | Undocumented Matlab On December 14, 2011 @ 11:55

[…] It so happens, that the undocumented built-in feature function (or its near-synonym system_dependent) enables improved performance […]

#9 Pingback By Profiling Matlab memory usage | Undocumented Matlab On March 1, 2012 @ 08:43

[…] in release R2008a (but not on newer releases) we could also use a nifty parameter of the undocumented feature function: >> feature mtic; a=ones(100); feature mtoc […]

#10 Comment By damayi On May 22, 2012 @ 12:39

Can you tell me what is the difference between feature(‘IsDebug’) and feature(‘IsDebugMode’);
What’s more, I found that feature(‘IsDebugMode’) will always get false result when you run it in you m code, but in debug command, you can get true. why?

#11 Comment By Alexander On October 23, 2012 @ 09:47

You could also add: system_dependent(7) which toggles command window text buffering. It can help if you output very large strings.

Btw, is there a way to query the current state? Or set it to on/off (not just toggle)? I.e. I don’t want to toggle it on and off – I just want to turn that off once.

#12 Comment By Yair Altman On October 24, 2012 @ 07:27

@Alexander – I don’t think you can query or set the state of this specific feature. In other features you can, but not here.

#13 Comment By Rye On April 2, 2013 @ 12:09

I found this feature while trying to debug a bizarre error I was having with a GPU function:


found this here: [41]

#14 Comment By Yair Altman On April 2, 2013 @ 14:17

@Rye – thanks

#15 Pingback By Using Java 7 in Matlab R2013a and earlier | Undocumented Matlab On June 19, 2013 @ 12:08

[…] R2013a does not have this problem; for R2012b a solution was found by setting the undocumented UseOldFileDialogs feature: feature('UseOldFileDialogs', […]

#16 Pingback By Undocumented feature list | Undocumented Matlab On March 19, 2014 @ 11:02

[…] 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. […]

#17 Comment By Holger Krause On April 3, 2014 @ 07:28

Matlab running on linux uses server-side font rendering. In case, the server doesn’t provide requested fonts, text in figures is rendered in a default font, and changes in fontsize are without effect. This can be overcome with:


In this mode, java seems to do the text rendering wihout relying on Xservers capabilities.

Tested in R2014a and R2013a.

#18 Pingback By Unicode characters in MATLAB source files – DexPage On July 9, 2015 @ 10:25

[…] can read more about this undocumented function here. See also this Matlab Central thread for other […]

#19 Comment By Karel Lebeda On September 23, 2016 @ 17:01

Is it me, is it Linux, or has this gone (in 2015a)?

>> which feature
built-in (undocumented)

>> feature memstats
Error using feature
Feature memstats not found
>> edit feature
(opens /opt/MWmatlabR2015a/toolbox/distcomp/@distcomp/feature.m)

#20 Comment By Yair Altman On September 23, 2016 @ 18:05

@Karel – feature memstats is a Windows-only feature

#21 Comment By matlab On November 13, 2016 @ 00:08

Thanks for kind useful information.

#22 Comment By Kristian Loewe On November 28, 2016 @ 18:26

It seems that feature(‘OpenGLLoadStatus’) has been dropped. It’s still available in R2014b but not in R2015b (Linux versions). Do you know if it’s still available in R2015a?

#23 Comment By Yair Altman On December 25, 2016 @ 18:50

@Kristian – yes, feature('OpenGLLoadStatus') works in R2015a. It would be interesting to know how you are using this feature – can you tell us?

#24 Comment By Kristian Loewe On March 7, 2017 @ 12:46

Thanks, Yair!

I am using it to assert that OpenGL is available upon starting up a GUI that I am developing. The GUI requires OpenGL in order to work as expected.

#25 Comment By Erivelton Geraldo Nepomuceno On May 12, 2017 @ 20:04


system_dep​endent(‘se​tround’,In​f) is still working on R2017a? Anyone has noticed something different? In previous version, I didn’t find any problem.

#26 Comment By Walter Roberson On June 22, 2018 @ 04:31

feature('COM_PassSafeArrayByRef', 1)

to turn on passing SAFEARRAY by reference to COM objects.

Described in [42]

#27 Comment By Yair Altman On June 25, 2018 @ 22:02

Thanks @Walter. Another related undocumented feature is

feature('COM_SafeArraySingleDim', 1)

, which makes SAFEARRAYs that are exported to COM objects 1-dimensional, rather than 2D (which is Matlab’s default). See discussion in [43].

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

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

URLs in this post:

[1] posted: http://stackoverflow.com/questions/2701215/matlab-feature-function

[2] entry in the official Matlab FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ#I.27ve_seen_system_dependent_on_the_newsgroup_before._What_does_it_do.3F

[3] online references: http://www.math.ufl.edu/help/matlab-faq.html

[4] says: http://www.mathworks.es/matlabcentral/newsreader/view_thread/19432#46055

[5] disabled since R2007a: https://www.mathworks.com/matlabcentral/newsreader/view_thread/268464

[6] accepts: https://www.mathworks.com/matlabcentral/newsreader/view_thread/155369

[7] here: http://www.mathworks.com/matlabcentral/fileexchange/18510-matlab-performance-measurement/content/Documents/MATLABperformance/configinfo.m

[8] here: https://www.mathworks.com/matlabcentral/newsreader/view_thread/76874#196081

[9] here: http://www.mathworks.com/support/solutions/en/data/1-21E4Y8/

[10] returns the Matlab process ID: http://www.mathworks.com/support/solutions/en/data/1-3L4JU7/

[11] returns the number of CPU cores: http://stackoverflow.com/questions/2626230/running-multiprocess-applications-from-matlab

[12] 1: http://www.mathworks.com/support/tech-notes/1100/1107.html#_Toc170182661

[13] 2: http://www.mathworks.com/support/tech-notes/1100/1106.html

[14] newsletter: http://www.mathworks.com/company/newsletters/digest/nov04/newfeatures.html#memory

[15] 1: http://www.mathworks.com/support/solutions/en/data/1-6OUI4W/

[16] 2: http://www.mathworks.com/support/solutions/en/data/1-1FKLSV

[17] online: http://www.google.com/search?as_q=matlab+feature&as_oq=memstats+dumpmem+processmem

[18] this official technical paper: http://www.mathworks.com/support/tech-notes/1100/1107.html

[19] here: http://www.mathworks.cn/matlabcentral/newsreader/view_thread/23048#57074

[20] here: http://www.ualberta.ca/dept/aict/bluejay/usr/local/matlab-6.5/toolbox/rtw/rtw/make_rtw.m

[21] here: https://www.mathworks.com/matlabcentral/newsreader/view_thread/122045#308094

[22] here: https://www.mathworks.com/matlabcentral/newsreader/view_thread/252869

[23] here: http://www.mathworks.com/access/helpdesk/bug_reports/bugfixes_matlab_7-0-4.html#Difference+Using+COM+Objects+in+MATLAB+and+Other+Applications

[24] here: http://www.mathworks.com/support/solutions/en/data/1-1WWIGS/

[25] technical solution: http://www.mathworks.com/support/solutions/en/data/1-81QJLT/

[26] this official technical solution: http://www.mathworks.com/support/solutions/en/data/1-1JYA58/

[27] here: http://undocumentedmatlab.com/blog/changing-system-preferences-programmatically/

[28] here: http://home.zcu.cz/~pkropik/PPEL/slozky/!!!_prednasky_aktualni/11_08_12_2009.txt

[29] here: http://www.oit.uci.edu/dcslib/matlab/matlab-v53/help/techdoc/newfeat/ch43.html#39969

[30] here: http://www.mathworks.com/support/solutions/en/data/1-1AN3H/

[31] here: https://www.mathworks.com/matlabcentral/newsreader/view_thread/17953

[32] OpenGL: http://www.mathworks.com/access/helpdesk/help/techdoc/ref/opengl.html

[33] feature(‘dwim’): https://www.mathworks.com/matlabcentral/newsreader/view_thread/274795#721595

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

[35] ismembc – undocumented helper function : https://undocumentedmatlab.com/articles/ismembc-undocumented-helper-function

[36] sprintfc – undocumented helper function : https://undocumentedmatlab.com/articles/sprintfc-undocumented-helper-function

[37] More undocumented timing features : https://undocumentedmatlab.com/articles/more-undocumented-timing-features

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

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

[40] : http://www.mathworks.com/support/bugreports/595677

[41] : http://www.mathworks.com/matlabcentral/answers/28500

[42] : https://www.mathworks.com/matlabcentral/answers/94888-how-can-i-pass-arguments-by-reference-to-an-activex-server-from-matlab-7-0-r14

[43] : https://www.mathworks.com/matlabcentral/answers/94833-how-can-i-use-in-matlab-a-com-object-that-uses-safearray-string-as-arguments

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