Split read_taffmat into functions for dat and hdr