I once again feel the need to say that MatLab is terrible and should be forgotten. Julia or R would be a much better alternative, so is python (with numPy generally) and even C++ with armadillo is better than matlab for most things.
MatLab, in addition to being slow, does not play with others and therefore causes vender lock in academic research. I am not going to rant about that now because it would never stop.