Update sdm_write.m