Main Content

mlreportgen.utils.makeSingleLineText

Convert input to single line

Description

example

singleline = mlreportgen.utils.makeSingleLineText(strchar_in) converts the input to a single line of text. Single spaces replace the line feeds and carriage returns in the input.

singleline = mlreportgen.utils.makeSingleLineText(strchar_in,delim) specifies the delimiter to use to replace line feeds and carriage returns.

Examples

Convert Character Array to Single Line

devTitle = ['Thomas R. Lee'; ...
            'Sr. Developer'; ...
            'SFTware Corp.'];
singleline = mlreportgen.utils.makeSingleLineText(devTitle)
singleline =

    'Thomas R. Lee Sr. Developer SFTware Corp.'

Input Arguments

collapse all

Input to convert to single line of text, specified as a character vector, string array, cell array of characters, or numeric array.

Delimiter to substitute for each line feed and carriage return, specified as a character vector or string scalar.

Output Arguments

collapse all

Single line of text, returned as a character vector or string scalar. The formatting of the output depends on the input type.

InputOutput
character vector or numeric arrayCharacter vector with line feeds and carriage returns removed.
string scalarString scalar with line feeds and carriage returns removed.
cell array of character vectorsCharacter vector with line feeds and carriage returns removed. Entries in the array are concatenated and separated using the delimiter.
string array

String scalar with line feeds and carriage returns removed. Entries in the array are concatenated and separated using the delimiter.

Version History

Introduced in R2018b