Merge new changes for Matlab Code