Small helper functions for matlab