class_docstr: Generic matlab matrix writing class 
class_docstr_tok: ["Generic","matlab","matrix","writing","class"]
code: def write_numeric(self, arr):
      imagf = arr.dtype.kind == "c"
      logif = arr.dtype.kind == "b"
      try:
          mclass = NP_TO_MXTYPES[arr.dtype.str[1:]]
      except KeyError:
          # No matching matlab type, probably complex256 / float128 / float96
          # Cast data to complex128 / float64.
          if imagf:
              arr = arr.astype("c128")
          elif logif:
              arr = arr.astype("i1")  # Should only contain 0/1
          else:
              arr = arr.astype("f8")
          mclass = mxDOUBLE_CLASS
      self.write_header(
          matdims(arr, self.oned_as),
          mclass,
          is_complex=imagf,
          is_logical=logif,
      )
      if imagf:
          self.write_element(arr.real)
          self.write_element(arr.imag)
      else:
          self.write_element(arr)
  
imports: from __future__ import division, print_function, absolute_import
  import os
  import time
  import sys
  import zlib
  from io import BytesIO
  import warnings
  import numpy
  from numpy.compat import asbytes, asstr
  import scipy.sparse
  from scipy._lib.six import string_types
  from .byteordercodes import native_code, swapped_code
  from .miobase import MatFileReader, docfiller, matdims, read_dtype, arr_to_chars, arr_dtype_number, MatWriteError, MatReadError, MatReadWarning
  from .mio5_utils import VarReader5
  from .mio5_params import MatlabObject, MatlabFunction, MDTYPES, NP_TO_MTYPES, NP_TO_MXTYPES, miCOMPRESSED, miMATRIX, miINT8, miUTF8, miUINT32, mxCELL_CLASS, mxSTRUCT_CLASS, mxOBJECT_CLASS, mxCHAR_CLASS, mxSPARSE_CLASS, mxDOUBLE_CLASS, mclass_info
  from .streams import ZlibInputStream
label_desc: Use image node_id 11 for calling the VarWriter5 obj's underlying member method code with example usage: obj.write_numeric(arr) without return types