Main Content

docblock

Get or set editor invoked by Simulink DocBlock block

Description

example

docblock(setEditorType,command) uses the specified command to set the editor opened by double-clicking a DocBlock block.

By default, a DocBlock block opens Microsoft® Word to edit HTML or RTF files. If Word is not available on your system, the block opens these file types using the text editor specified on the Editor/Debugger Preferences pane of the MATLAB® Preferences dialog box. For text files, the default editor is the text editor specified in the MATLAB preferences.

The editor specifications persist between MATLAB sessions.

example

editCommand = docblock(getEditorType) returns the current command to open the specified editor from a DocBlock block.

Examples

collapse all

Specify Notepad as the DocBlock editor for text files.

docblock('setEditorTXT','system(''notepad "%<FileName>"'');')

You can use the docblock command to get the current editor.

Set your HTML editor for the DocBlock block to Mozilla Composer. The ampersand executes the command in the background.

docblock('setEditorHTML',...
   'system(''/usr/local/bin/mozilla -edit "%<FileName>" &'');')

Get the current HTML editor.

htmlEd = docblock('getEditorHTML')
htmlEd =

    'system('/usr/local/bin/mozilla -edit "%<FileName>" &');'

Specify Notepad as the DocBlock editor for text files.

docblock('setEditorTXT','system(''notepad "%<FileName>"'');')

Get the current text editor.

txtEd = docblock('getEditorTXT')
txtEd =

    'system('notepad "%<FileName>"');'

Reset the editor to the default editor.

docblock('setEditorTXT','')

Input Arguments

collapse all

File type for which to set editor command, specified as 'setEditorHTML', 'setEditorDOC', or 'setEditorTXT'.

Command to open file type in editor from the MATLAB Command Window, specified as a character vector. Use '' to reset to the default editor for that file type.

In the command, use the "%<FileName>" token to represent the full pathname to the document.

File type of editor command to return, specified as 'getEditorHTML', 'getEditorDOC', or 'getEditorTXT'.

Output Arguments

collapse all

Command to open editor, returned as a character vector.

Version History

Introduced in R2007a

expand all