string.strip
string: newstr = strip (str)
string: newstr = strip (str, side)
string: newstr = strip (str, stripchar)
string: newstr = strip (str, side, stripchar)
Remove leading and trailing characters from string array.
newstr = strip (str) removes all consecutive
whitespace characters from the beginning and end of each element of
str. The whitespace characters are the space, tab, newline,
carriage return, form feed, and vertical tab.
newstr = strip (str, side) removes whitespace
from the side given by side, which can be "left",
"right", or "both" (the default).
newstr = strip (str, stripchar) removes the
single character stripchar instead of whitespace. Because the side
keywords are longer than one character, a single-character second
argument is always treated as stripchar.
newstr = strip (str, side, stripchar)
removes stripchar from the given side.
newstr is a string array of the same size as str. Missing values in str are preserved.
Source Code: string
strip removes leading and trailing whitespace from each string.
s = string ({' spaced '; 'tidy'})
s =
2x1 string array
" spaced "
"tidy"
strip (s)
ans =
2x1 string array
"spaced"
"tidy"