using matlabpool to speedup