def write(self, arr, name):
<EOL>if scipy.sparse.issparse(arr):<EOL><INDENT>self.write_sparse(arr, name)<EOL>return<EOL><DEDENT>arr = np.asarray(arr)<EOL>dt = arr.dtype<EOL>if not dt.isnative:<EOL><INDENT>arr = arr.astype(dt.newbyteorder('<STR_LIT:=>'))<EOL><DEDENT>dtt = dt.type<EOL>if dtt is np.object_:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>elif dtt is np.void:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>elif dtt in (np.unicode_, np.string_):<EOL><INDENT>self.write_char(arr, name)<EOL>return<EOL><DEDENT>self.write_numeric(arr, name)<EOL>
Write matrix `arr`, with name `name`

        Parameters
        ----------
        arr : array-like
           array to write
        name : str
           name in matlab workspace