function [res,ok] = cell2num(cellArray) res=zeros(length(cellArray),1); m = 0; ok = 1; for n=1:length(cellArray) l=cellArray{n,:}; if ischar(l) l=str2num(l); end if ~isempty(l) m=m+1; res(m) = l; else res = 'no string'; ok = 0; end end