Trims the data of extra columns, note your array names cannot be named 'X' or start with 'X.'
trim.dat(dat)
result