MATLAB: Get rid of empty spaces in cells containing strings

cellsremove spaces

Hi everyone,
I have created a cell 62×1, cell_sample, which reads like this:
'103'
'114'
' 25'
' 9'
' 13'
' 8'
' 12'
' 26'
and so on.. till the last cell. The problem is that it always has 3 characters, so for a one digit number I am getting 2 spaces and the number, for a two digit number I'm getting one space and the number, etc. I want to remove the spaces to get sth like this:
'103'
'114'
'25'
'9'
'13'
'8'
'12'
'26'
The data is read from an excel sheet, piece of code:
sample=xlsread('screws.xlsx',1,'H2:H63')
Num_sample=num2str(sample)
cell_sample = cellstr(Num_sample)

Best Answer

str={'103';'114';' 25';' 9';' 13';' 8';' 12';' 26'}
out=strtrim(str)