changed generate.py to generate data for matlab