add write matcrs function (public)