Add two functions to generate training and test data matrices