MATLAB: Operate a string in a cell matrix

cell matrix stringMATLAB

Hi, I have a cell matrix imported from excel:
[39] [1232] [ 567] [ NaN]
[40] [ 48] [ 41] [ 949]
[41] [ 48] [ 1686] [ 40]
[42] [ 754] [ 753] [ 40]
[43] [ 48] '800 1069 1152' [ 983]
[44] [ 43] [ 48] '700 109 152'
[45] [ 52] [ 1340] [ 1363]
[46] [1340] [ 45] [ 1594]
there are all number with each taking one gird in excel except two "800 1069 1152" and '700 109 152' taking a single grid. In matlab, by [num,txt,raw] = xlsread() the raw matrix is a cell matrix with '800 1069 1152' a string. Is there a way I want to just keep 800, and 700 from those two strings, and convert this cell matrix to a normal matrix for future programming?
Thank you for any suggestion Kyle

Best Answer

A={[39] [1232] [ 567] [ NaN]
[40] [ 48] [ 41] [ 949]
[41] [ 48] [ 1686] [ 40]
[42] [ 754] [ 753] [ 40]
[43] [ 48] '800 1069 1152' [ 983]
[44] [ 43] [ 48] '700 109 152'
[45] [ 52] [ 1340] [ 1363]
[46] [1340] [ 45] [ 1594]}
r=cellfun(@(x) isstr(x),A)
q=cellfun(@(x) regexp(x,' ','split'),A(r),'uni',false)
A(find(r==1))=num2cell(cellfun(@(x) str2num(x{1}),q))
out=cell2mat(A)