It appears there is no reason to use cellfun. str2double is already vectorized and works with cells. However, when comparing performance cellfun is actually significantly (i.e. measurable) faster!
S={'1406200719565'
'1406200719583'
'1406200719598'
'1406200730211'
'1406200730226'
'1406200730242'
'1406200731023'
'1406200731889'
'1406200732801'
'1406200733670'}
X = zeros(10,1);
tic
for ii = 1:20000
X=str2double(S);
end
toc
Output: Elapsed time is 3.908324 seconds.
tic
for ii = 1:20000
X = cellfun(@str2double, S);
end
toc
Output: Elapsed time is 3.357150 seconds.
As suggested by @Divakar a comparison using a larger cell array emphasizing the gain in performance by using cullfun:
S=cellstr(num2str(randi(150000,10000,1)));
X = zeros(150000,10000);
tic
X=str2double(S);
toc
tic
X = cellfun(@str2double, S);
toc
Resulting in:
Direct: Elapsed time is 0.778316 seconds.
Using cellfun: Elapsed time is 0.173727 seconds.
Note
Virtually no difference in using str2num or str2double. str2num seems 3% slower, but is not significantly.