Some useful functions for usage in matlab/octave etc