deblank

Trims trailing whitespaces from strings, matrices and cell arrays. For matrices, trailing whitespaces are stripped from each row to the size of the longest string in the matrix, to make the length of each row consistent.

Syntax

R = deblank(s)

Inputs

s
Type: string | mat | cell

Outputs

R
Type: string | mat | cell

Examples

String input:
R = deblank(' deblankExample1   ')
R =  deblankExample1
Matrix input:
R = deblank([' string1234   '; '  string12    '])
R =
string1234
string12
Cell array input:
R = deblank({'123   ', '  example3     '})
R =
{
[1,1] 123
[1,2]   example3
}