dash.assert.strflag

Throw error if input is not a string scalar, cellstring scalar, or char row vector.


Syntax



Description

str = dash.assert.strflag(input)

Checks if an input is either a string scalar, cellstring scalar, or char row vector. If not, throws an error. If so, returns the input as a string data type.

str = dash.assert.strflag(input, name)

Refers to the input by a custom name in thrown error messages.

str = dash.assert.strflag(input, name, idHeader)

Uses a custom header for thrown error IDs.


Input Arguments

input

any data type
The input being tested

name

string scalar
Name of the input in the calling function. Default is “input”.

idHeader

string scalar
Header for thrown error IDs. Default is “DASH:assert:strflag”.

Output Arguments

str

string scalar
The input converted to a string data type.