docstr: Write header for given data options
  
  Parameters
  ----------
  name : str
      name of variable
  shape : sequence
     Shape of array as it will be read in matlab
  P : int, optional
      code for mat4 data type, one of ``miDOUBLE, miSINGLE, miINT32,
      miINT16, miUINT16, miUINT8``
  T : int, optional
      code for mat4 matrix class, one of ``mxFULL_CLASS, mxCHAR_CLASS,
      mxSPARSE_CLASS``
  imagf : int, optional
      flag indicating complex
docstr_tok: ["Write","header","for","given","data","options","Parameters","--","--","--","--","--","name",":","str","name","of","variable","shape",":","sequence","Shape","of","array","as","it","will","be","read","in","matlab","P",":","int",",","optional","code","for","mat4","data","type",",","one","of","``","miDOUBLE",",","miSINGLE",",","miINT32",",","miINT16",",","miUINT16",",","miUINT8","``","T",":","int",",","optional","code","for","mat4","matrix","class",",","one","of","``","mxFULL_CLASS",",","mxCHAR_CLASS",",","mxSPARSE_CLASS","``","imagf",":","int",",","optional","flag","indicating","complex"]
code: def write_header(
      self, name, shape, P=miDOUBLE, T=mxFULL_CLASS, imagf=0
  ):
      """Write header for given data options
  
      Parameters
      ----------
      name : str
          name of variable
      shape : sequence
         Shape of array as it will be read in matlab
      P : int, optional
          code for mat4 data type, one of ``miDOUBLE, miSINGLE, miINT32,
          miINT16, miUINT16, miUINT8``
      T : int, optional
          code for mat4 matrix class, one of ``mxFULL_CLASS, mxCHAR_CLASS,
          mxSPARSE_CLASS``
      imagf : int, optional
          flag indicating complex
      """
      header = np.empty((), mdtypes_template["header"])
      M = not SYS_LITTLE_ENDIAN
      O = 0
      header["mopt"] = M * 1000 + O * 100 + P * 10 + T
      header["mrows"] = shape[0]
      header["ncols"] = shape[1]
      header["imagf"] = imagf
      header["namlen"] = len(name) + 1
      self.write_bytes(header)
      data = name + "\0"
      self.write_string(data.encode("latin1"))
  
imports: import sys
  import warnings
  import numpy
  import scipy.sparse
  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 4 for calling the VarWriter4 obj's underlying member method code with example usage: obj.write_header(name, shape, P, T, imagf) without return types