class_docstr: Generic matlab matrix writing class 
docstr: Write header for given data options
  shape : sequence
     array shape
  mclass      - mat5 matrix class
  is_complex  - True if matrix is complex
  is_logical  - True if matrix is logical
  nzmax        - max non zero elements for sparse arrays
  
  We get the name and the global flag from the object, and reset
  them to defaults after we've used them
docstr_tok: ["Write","header","for","given","data","options","shape",":","sequence","array","shape","mclass","-","mat5","matrix","class","is_complex","-","True","if","matrix","is","complex","is_logical","-","True","if","matrix","is","logical","nzmax","-","max","non","zero","elements","for","sparse","arrays","We","get","the","name","and","the","global","flag","from","the","object",",","and","reset","them","to","defaults","after","we","'ve","used","them"]
code: def write_header(
      self, shape, mclass, is_complex=False, is_logical=False, nzmax=0
  ):
      """Write header for given data options
      shape : sequence
         array shape
      mclass      - mat5 matrix class
      is_complex  - True if matrix is complex
      is_logical  - True if matrix is logical
      nzmax        - max non zero elements for sparse arrays
  
      We get the name and the global flag from the object, and reset
      them to defaults after we've used them
      """
      # get name and is_global from one-shot object store
      name = self._var_name
      is_global = self._var_is_global
      # initialize the top-level matrix tag, store position
      self._mat_tag_pos = self.file_stream.tell()
      self.write_bytes(self.mat_tag)
      # write array flags (complex, global, logical, class, nzmax)
      af = np.zeros((), NDT_ARRAY_FLAGS)
      af["data_type"] = miUINT32
      af["byte_count"] = 8
      flags = is_complex << 3 | is_global << 2 | is_logical << 1
      af["flags_class"] = mclass | flags << 8
      af["nzmax"] = nzmax
      self.write_bytes(af)
      # shape
      self.write_element(np.array(shape, dtype="i4"))
      # write name
      name = np.asarray(name)
      if name == "":  # empty string zero-terminated
          self.write_smalldata_element(name, miINT8, 0)
      else:
          self.write_element(name, miINT8)
      # reset the one-shot store to defaults
      self._var_name = ""
      self._var_is_global = False
  
imports: import os
  import time
  import sys
  import zlib
  from io import BytesIO
  import warnings
  import numpy
  import scipy.sparse
  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, mat_struct
  from .streams import ZlibInputStream
label_desc: Use image node_id 7 for calling the VarWriter5 obj's underlying member method code with example usage: obj.write_header(shape, mclass, is_complex, is_logical, nzmax) without return types