current_path = pwd();
setup_path = fileparts(mfilename('fullpath'));
src_path = sprintf('%s%s..%ssrc%s',setup_path,filesep(),filesep(),filesep());
cd(src_path);

mex -silent -lm -lfftw3 CFLAGS="\$CFLAGS -std=c99" tools.c irregularsampling_kernel.c irregularsampling_mexinterface.c -output irregularsampling_mexinterface
mex -silent -lm -lfftw3 CFLAGS="\$CFLAGS -std=c99" tools.c sardecomp_kernel.c sardecomp_mexinterface.c -output sardecomp_mexinterface

cd(current_path);