Added Matlab functionality