matlab function to write out bad channels.