add 1d matlab code