adding matlab function for data formatting