docstr: Write matrix `arr`, with name `name`
  
  Parameters
  ----------
  arr : array_like
     array to write
  name : str
     name in matlab workspace
docstr_tok: ["Write","matrix","`","arr","`",",","with","name","`","name","`","Parameters","--","--","--","--","--","arr",":","array_like","array","to","write","name",":","str","name","in","matlab","workspace"]
code: def write(self, arr, name):
      """Write matrix `arr`, with name `name`
  
      Parameters
      ----------
      arr : array_like
         array to write
      name : str
         name in matlab workspace
      """
      # we need to catch sparse first, because np.asarray returns an
      # an object array for scipy.sparse
      if scipy.sparse.issparse(arr):
          self.write_sparse(arr, name)
          return
      arr = np.asarray(arr)
      dt = arr.dtype
      if not dt.isnative:
          arr = arr.astype(dt.newbyteorder("="))
      dtt = dt.type
      if dtt is np.object_:
          raise TypeError("Cannot save object arrays in Mat4")
      elif dtt is np.void:
          raise TypeError("Cannot save void type arrays")
      elif dtt in (np.unicode_, np.string_):
          self.write_char(arr, name)
          return
      self.write_numeric(arr, name)
  
imports: from __future__ import division, print_function, absolute_import
  import sys
  import warnings
  import numpy
  from numpy.compat import asbytes, asstr
  import scipy.sparse
  from scipy._lib.six import string_types
  from .miobase import MatFileReader, docfiller, matdims, read_dtype, convert_dtypes, arr_to_chars, arr_dtype_number
  from .mio_utils import squeeze_element, chars_to_strings
  from functools import reduce
label_desc: Use image node_id 5 for calling the VarWriter4 obj's underlying member method code with example usage: obj.write(arr, name) without return types