This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

matlab.editor Settings

Editor settings, including language, backup, and display settings

You can customize the visual appearance and behavior of the Editor using matlab.editor settings. Access matlab.editor settings using the root SettingsGroup object returned by the settings function. For example, set the temporary value for the maximum column width for comments to 80.

s = settings;
s.matlab.editor.language.matlab.comments.MaxWidth.TemporaryValue = 80

For more information about settings, see Access and Modify Settings.

Most matlab.editor settings do not apply in the Live Editor.

matlab.editor

Change the default editor and how the MATLAB® Editor behaves under various circumstances using these settings.

SettingDescription
UseMATLABEditor

Whether to use the MATLAB Editor, specified as 1 (default) or 0.

Set to 1 if you want the MATLAB desktop to use the MATLAB Editor when you edit a file.

Example: s.matlab.editor.UseMATLABEditor.TemporaryValue = 0

OtherEditor

Other editor name, specified as a character vector.

If UseMATLABEditor is set to 0, specify the full path for the editor application you want to use, such as Emacs or vi.

Example: s.matlab.editor.OtherEditor.TemporaryValue = 'c:\Applications\Emacs.exe'

RecentFileListSize

Number of recent files to display in the Open menu, specified as a positive integer.

Example: s.matlab.editor.RecentFileListSize.TemporaryValue = 5

ReopenFilesOnRestart

Whether to reopen files on restart, specified as 1 (default) or 0.

Set to 1 if you want the Editor and the files it contained during your last MATLAB session to reopen when you restart MATLAB.

Example: s.matlab.editor.AddLineTerminationOnsave.TemporaryValue = 0

OpenFilesAtBreakpoint

Whether to open a file at a breakpoint, specified as 1 (default) or 0.

Set to 1 to open a running program file when MATLAB encounters a breakpoint in that file.

Example: s.matlab.editor.OpenFilesAtBreakpoint.TemporaryValue = 0

SaveFilesOnClickAway

Whether to save files when you click away, specified as 1 (default) or 0.

Set to 1 if you want the Editor to automatically save changes to a file in the Editor when you click away from the Editor. For the changes to be automatically saved upon clicking away from the Editor, you must have already saved the file at least once.

Example: s.matlab.editor.SaveFilesOnClickAway.TemporaryValue = 0

ReloadFilesOnChange

Whether to reload files when they change, specified as 1 (default) or 0.

Set to 1 if you want the Editor to automatically reload the new version of a file that you opened and edited outside of MATLAB. MATLABonly reloads the file if it contains no unsaved changes.

Example: s.matlab.editor.ReloadFilesOnChange.TemporaryValue = 0

AddLineTerminationOnSave

Whether to add a new empty line when you save, specified as 1 (default) or 0.

Set to 1 to have MATLAB add a new empty line (sometimes referred to as a <CR>) to the end of a file automatically if the last line in the file is not empty.

Example: s.matlab.editor.AddLineTerminationOnSave.TemporaryValue = 0

OnlyStepInToUserFunctions

Whether to only step into user-defined functions and scripts when debugging in the Live Editor, specified as 1 (default) or 0.

Set to 1 to only step into user-defined functions and scripts when debugging in the Live Editor. Set to 0 to step into MathWorks® functions as well.

Example: s.matlab.editor.OnlyStepInToUserFunctions.TemporaryValue = 0

matlab.editor.displaysettings

Change the appearance of the Editor using these settings.

SettingDescription
HighlightCurrentLine

Whether to highlight the current line, specified as 1 (default) or 0.

Set to 1 to highlight the current line. The current line is the line with the cursor (also called the caret).

Example: s.matlab.editor.displaysettings.HighlightCurrentLine.TemporaryValue = 0

HighlightCurrentLineColor

Line color of current line, specified as an RGB triplet with values in the range [0,255]. The current line is the line with the cursor (also called the caret).

HighlightCurrentLine must be set to 1 to see the change in the current line color.

Example: s.matlab.editor.displaysettings.HighlightCurrentLineColor.TemporaryValue = [222 230 200]

ShowLineNumbers

Whether to show line numbers, specified as 1 (default) or 0. This setting applies in both the Editor and Live Editor.

Set to 1 to display line numbers along the left edge of the Editor window.

Example: s.matlab.editor.displaysettings.ShowLineNumbers.TemporaryValue = 0

DataTipsInEditMode

Whether to enable data tips when editing, specified as 1 (default) or 0.

Set to 1 to display data tips when you are editing a MATLAB code file. (Data tips are always enabled in debug mode.)

Example: s.matlab.editor.displaysettings.DataTipsInEditMode.TemporaryValue = 0

matlab.editor.displaysettings.linelimit

Change the appearance of the line limit in the Editor using these settings.

SettingDescription
ShowLine

Whether to display the line limit, specified as 1 (default) or 0.

Set to 1 to display a vertical line at a specified column in the Editor to denote the right-hand text limit. LineColumn specifies the location of the line, and LineWidth specifies the width of the line.

Example: s.matlab.editor.displaysettings.linelimit.ShowLine.TemporaryValue = 0

LineColumn

Location of the line limit, specified as a positive integer.

Specify the location as a column number.

Example: s.matlab.editor.displaysettings.linelimit.LineColumn.TemporaryValue = 80

LineWidth

Width of the line limit, specified as a positive integer.

Example: s.matlab.editor.displaysettings.linelimit.LineWidth.TemporaryValue = 2

matlab.editor.tab

Change the size of tabs and indents and how tabs behave in the Editor using these settings.

SettingDescription
TabSize

Number of spaces inserted when you press the Tab key, specified as a positive integer.

When you change the TabSize, it changes the tab size for existing lines in that file, unless you also set InsertSpaces to 1.

Example: s.matlab.editor.tab.TabSize.TemporaryValue = 5

IndentSize

Indent size for smart indenting, specified as a positive integer. For more information about smart indenting, see Improve Code Readability.

Example:s.matlab.editor.tab.IndentSize.TemporaryValue = 5

InsertSpaces

Whether to insert spaces when you press the Tab key, specified as a 1 (default) or 0.

Set to 1 to insert a series of spaces when you press the Tab key. Otherwise, a tab acts as one space whose length is equal to the TabSize.

Example: s.matlab.editor.tab.InsertSpaces.TemporaryValue = 0

EmacsStyle

Whether to use Emacs indenting style, specified as 1 (default) or 0.

Set to 1 to use an indenting style similar to the style that the Emacs editor uses.

Example: s.matlab.editor.tab.IndentSize.TemporaryValue = 5

matlab.editor.language.matlab

Change how MATLAB code appears in the Editor using these settings.

SettingDescription
EnableSyntaxHighlighting

Whether to enable syntax highlighting, specified as 1 (default) or 0.

Set to 1 to have the Editor use different colors for different language constructs. Then, adjust the colors you want to use for each language element. For more information, see Syntax Highlighting.

Example: s.matlab.editor.language.matlab.EnableSyntaxHighlighting.TemporaryValue = 0

EnableVariableAndFunctionRenaming

Whether to enable variable and function renaming, specified as 1 (default) or 0.

Set to 1 to have MATLAB prompt you to rename all instances of a function or variable in a file when you rename a single instance.

Example: s.matlab.editor.language.matlab.EnableVariableAndFunctionRenaming.TemporaryValue = 0

matlab.editor.language.matlab.comments

Change how MATLAB comments appear in the Editor using these settings. These settings apply in both the Editor and Live Editor.

SettingDescription
MaxWidth

Maximum number of characters in a comment line, specified as a positive integer.

Specify FromCommentStart to select where you want counting to begin.

Example: s.matlab.editor.language.matlab.comments.MaxWidth.TemporaryValue = 80

FromCommentStart

Whether to count maximum width from comment start, specified as 1 (default) or 0.

Set to 1 to count width from the beginning of a comment. This is useful when comments are indented, and you want each block of comments to have the same indent and width.

Set to 0 to count width from the beginning of a line. This is useful when the absolute width of the comments is important. For example, set the maximum width to 75 columns and set FromCommentStart to 0 to make your code fit on a printed page when you use the default font for the Editor.

Example: s.matlab.editor.language.matlab.comments.FromCommentStart.TemporaryValue = 0

WrapAutomatically

Whether to wrap comments automatically, specified as 1 (default) or 0.

Set to 1 to automatically wrap comments after MaxWidth columns when you type comments in an Editor document.

Example: s.matlab.editor.language.matlab.comments.WrapAutomatically.TemporaryValue = 0

matlab.editor.codefolding

Enable or disable code folding using this setting.

SettingDescription
EnableCodeFolding

Whether to enable code folding, specified as 1 (default) or 0.

Set to 1 to enable code folding.

Example: s.matlab.editor.codefolding.EnableCodeFolding.TemporaryValue = 0

matlab.editor.backup

Change if, when, and how MATLAB automatically backs up files that are open in the Editor using these settings.

SettingDescription
EnableFileBackup

Whether to enable file backups, specified as 1 (default) or 0.

Set to 1 to automatically save copies of the files you are currently editing.

Example: s.matlab.editor.backup.EnableFileBackup.TemporaryValue = 0

Frequency

How often to create a backup of the file you are editing, specified in minutes as a positive integer.

Example: s.matlab.editor.backup.Frequency.TemporaryValue = 6

SaveUntiltled

Whether to create backups of untitled files, specified as 1 (default) or 0.

Set to 1 to save a copy of a new, untitled, file to Untitled.asv. When there is more than one untitled file, each additional file is saved to Untitledn.asv (where n is an integer value).

Example: s.matlab.editor.backup.SaveUntitled.TemporaryValue = 0

DeleteOnClose

Whether to delete backup files on close, specified as 1 (default) or 0.

Set to 1 to direct MATLAB to delete the backup file when you close the source file in the Editor.

Example: s.matlab.editor.backup.DeleteOnClose.TemporaryValue = 0

FileExtensionToReplace

File extension of backup file that replaces the original file name extension, specified as a character vector.

The default extension is asv.

Example: s.matlab.editor.backup.FileExtensionToReplace.TemporaryValue = 'asv'

FileExtensionToAppend

File extension of backup file to append to the original file name, specified as a character vector.

The default extension is ~.

Example: s.matlab.editor.backup.FileExtensionToAppend.TemporaryValue = '~'

SaveIntoSourceFolder

Whether to save backup files to the source folder, specified as 1 (default) or 0.

Set to 1 to store backup files in the same folder as the files being edited. Otherwise, MATLAB saves the backup files in the folder specified by SaveToFolder.

Example: s.matlab.editor.backup.SaveIntoSourceFolder.TemporaryValue = 0

SaveToFolder

Folder name in which to store all backup files, specified as a character vector.

Specify the full path to that folder and be sure you have write permissions for it.

SaveIntoSourceFolder must be set to 0. Otherwise, MATLAB stores backup files in the same folder as the files being edited.

Example: s.matlab.editor.backup.SaveToFolder.TemporaryValue = 'C:\backups'

matlab.editor.autoformat

Enable and disable autoformatting as a whole or for individual types of formatting using these settings.

SettingDescription
EnableAutoFormatting

Whether to enable autoformatting, specified as 1 (default) or 0.

Set to 1 to enable autoformatting in the Live Editor. Once enabled, specific types of formatting can then be enabled or disabled individually.

Example: s.matlab.editor.autoformat.EnableAutoFormatting.TemporaryValue = 0

AsteriskForItalicAndBold

Whether to enable italic and bold formatting using asterisks, specified as 1 (default) or 0.

Set to 1 to enable bold and italic formatting using asterisks (*).

Example: s.matlab.editor.autoformat.AsteriskForItalicAndBold.TemporaryValue = 0

UnderscoreForItalicAndBold

Whether to enable italic and bold formatting using underscores, specified as 1 (default) or 0.

Set to 1 to enable bold and italic formatting using underscores (_).

Example: s.matlab.editor.autoformat.UnderscoreForItalicAndBold.TemporaryValue = 0

BacktickAndBarForMonospace

Whether to enable monospace formatting using backticks or bars, specified as 1 (default) or 0.

Set to 1 to enable monospace formatting using backticks (`) or bars (|).

Example: s.matlab.editor.autoformat.BacktickAndBarForMonospace.TemporaryValue = 0

SectionBreak

Whether to enable autoformatting for section breaks, specified as 1 (default) or 0.

Set to 1 to enable inserting section breaks by entering %%, ***, or --- and then Enter.

Example: s.matlab.editor.autoformat.SectionBreak.TemporaryValue = 0

SectionBreakAndHeading

Whether to enable autoformatting for section breaks with headings, specified as 1 (default) or 0.

Set to 1 to enable inserting section breaks with headings by entering %%text and then Enter.

Example: s.matlab.editor.autoformat.SectionBreakAndHeading.TemporaryValue = 0

DollarSignForLatex

Whether to enable autoformatting for LaTeX expressions, specified as 1 (default) or 0.

Set to 1 to enable converting LaTeX expressions into equations using the format $LaTeX$.

Example: s.matlab.editor.autoformat.DollarSignForLatex.TemporaryValue = 0

URLToHyperlink

Whether to enable autoformatting for URLs, specified as 1 (default) or 0.

Set to 1 to enable converting URLs automatically to hyperlinks.

Example: s.matlab.editor.autoformat.URLToHyperlink.TemporaryValue = 0

AngleBracketsForHyperlink

Whether to enable autoformatting for URLs using angle brackets, specified as 1 (default) or 0.

Set to 1 to enable converting URLs to hyperlinks using the format <URL>.

Example: s.matlab.editor.autoformat.AngleBracketsForHyperlink.TemporaryValue = 0

LabelURLToHyperlink

Whether to enable autoformatting for labeled hyperlinks, specified as 1 (default) or 0.

Set to 1 to enable converting URLs to labeled hyperlinks using the format [Label](URL).

Example: s.matlab.editor.autoformat.LabelURLToHyperlink.TemporaryValue = 0

TrademarkCopyrightSymbol

Whether to enable autoformatting for trademark and copyright symbols, specified as 1 (default) or 0.

Set to 1 to enable inserting trademark and copyright symbols (™, ℠, ®, and ©) using the format (TM), (SM), (R), and (C).

Example: s.matlab.editor.autoformat.TrademarkCopyrightSymbol.TemporaryValue = 0

HashtagForTitle

Whether to enable inserting titles using hashtags, specified as 1 (default) or 0.

Set to 1 to enable inserting titles using the format #text.

Example: s.matlab.editor.autoformat.HashtagForTitle.TemporaryValue = 0

HashtagsForHeading

Whether to enable inserting headings using hashtags, specified as 1 (default) or 0.

Set to 1 to enable inserting headings using the format ##text for heading 1, ###text for heading 2, or ####text for heading 3.

Example: s.matlab.editor.autoformat.HashtagsForHeading.TemporaryValue = 0

AutomaticBulletedList

Whether to enable creating bulleted lists automatically, specified as 1 (default) or 0.

Set to 1 to enable creating bulleted lists by entering *, +, or - followed by a space.

Example: s.matlab.editor.displaysettings.AutomaticBulletedList.TemporaryValue = 0

AutomaticNumberedList

Whether to enable creating numbered lists automatically, specified as 1 (default) or 0.

Set to 1 to enable creating numbered lists by entering 1., 2., and so on, followed by a space.

Example: s.matlab.editor.displaysettings.AutomaticNumberedList.TemporaryValue = 0

matlab.editor.autocoding

Enable and disable autocoding as a whole or for individual features using these settings.

SettingDescription
EnableAutoCoding

Whether to enable autocoding, specified as 1 (default) or 0.

Set to 1 to enable autocoding in the Live Editor. Once enabled, options can be enabled or disabled individually.

Example: s.matlab.editor.autocoding.EnableAutoCoding.TemporaryValue = 0

Parentheses

Whether to autocomplete parentheses, specified as 1 (default) or 0.

Set to 1 to enable autocompletion of parentheses.

Example: s.matlab.editor.autocoding.Parentheses.TemporaryValue = 0

CurlyBraces

Whether to autocomplete curly braces, specified as 1 (default) or 0.

Set to 1 to enable autocompletion of curly braces.

Example: s.matlab.editor.autocoding.CurlyBraces.TemporaryValue = 0

SquareBrackets

Whether to autocomplete square brackets, specified as 1 (default) or 0.

Set to 1 to enable autocompletion of square brackets.

Example: s.matlab.editor.autocoding.SquareBrackets.TemporaryValue = 0

SingleQuotes

Whether to autocomplete single quotes, specified as 1 (default) or 0.

Set to 1 to enable autocompletion of single quotes.

Example: s.matlab.editor.autocoding.SingleQuotes.TemporaryValue = 0

DoubleQuotes

Whether to autocomplete double quotes, specified as 1 (default) or 0.

Set to 1 to enable autocompletion of double quotes.

Example: s.matlab.editor.autocoding.DoubleQuotes.TemporaryValue = 0

Comments

Whether to autocomplete comments, specified as 1 (default) or 0.

Set to 1 to enable autocompletion of comments when split across two lines.

Example: s.matlab.editor.autocoding.Comments.TemporaryValue = 0

CharacterVectors

Whether to autocomplete character vectors, specified as 1 (default) or 0.

Set to 1 to enable autocompletion of character vectors when split across two lines.

Example: s.matlab.editor.autocoding.CharacterVectors.TemporaryValue = 0

Strings

Whether to autocomplete strings, specified as 1 (default) or 0. Set to 1 to enable autocompletion of strings when split across two lines.

Example: s.matlab.editor.autocoding.Strings.TemporaryValue = 0

ControlFlows

Whether to autocomplete control flow statements, specified as 1 (default) or 0. Set to 1 to enable autocompletion of control flow statements such as if and for.

Example: s.matlab.editor.autocoding.ControlFlows.TemporaryValue = 0

Definitions

Whether to autocomplete function and class definitions, specified as 1 (default) or 0. Set to 1 to enable autocompletion of function and class definitions.

Example: s.matlab.editor.autocoding.Definitions.TemporaryValue = 0

Introduced in R2018a