| MATLAB Function Reference | ![]() |
str = deblank(str)
c = deblank(c)
str = deblank(str) removes all trailing whitespace and null characters from the end of character string str. A whitespace is any character for which the isspace function returns logical 1 (true).
c = deblank(c) when c is a cell array of strings, applies deblank to each element of c.
The deblank function is useful for cleaning up the rows of a character array.
Compose a string str that contains space, tab, and null characters:
NL = char(0); TAB = char(9); str = [NL 32 TAB NL 'AB' 32 NL 'CD' NL 32 TAB NL 32];
Display all characters of the string between | symbols:
['|' str '|']
ans =
| AB CD |Remove trailing whitespace and null characters, and redisplay the string:
newstr = deblank(str);
['|' newstr '|']
ans =
| AB CD|A{1,1} = 'MATLAB ';
A{1,2} = 'SIMULINK ';
A{2,1} = 'Toolboxes ';
A{2,2} = 'The MathWorks ';
A =
'MATLAB ' 'SIMULINK '
'Toolboxes ' 'The MathWorks '
deblank(A)
ans =
'MATLAB' 'SIMULINK'
'Toolboxes' 'The MathWorks'
![]() | deal | debug | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |