Get tab size via command line

Is there an automated way to get the tab size of the Matlab editor and the command window? Yes, you can just open the settings window and see it yourself, but I want it to be automated. In fact, I think that this could be generalized to get any of these user settings in the screenshot below.

enter image description here

+5
source share
1 answer

I found the solution pretty quickly, and after thinking it is best to share this link:

http://undocumentedmatlab.com/blog/changing-system-preferences-programmatically/

So what do you do:

  • Open the settings file and find the preference you want to read:

    edit(fullfile(prefdir,'matlab.prf'));
    

    CommandWindowSpacesPerTab=I4 EditorSpacesPerTab=I4, . , ( ).

  • , :

    com.mathworks.services.Prefs.get<type>Pref(<pref-name>)
    

    :

    >> com.mathworks.services.Prefs.getIntegerPref('EditorSpacesPerTab')
    ans =
    
        4
    

: Matlab

: -, . ..: , , , . 0. :

if loadedpref==0
    set default
end

EDIT2: matlab linux, ( 8). , :

function retval = isCommandWindowOpen()
    jDesktop = com.mathworks.mde.desk.MLDesktop.getInstance;
    retval = ~isempty(jDesktop.getClient('Command Window'));
end
+7

All Articles