class_docstr: Class to read matlab 4 variables 
class_docstr_tok: ["Class","to","read","matlab","4","variables"]
docstr: Read the shape of the array described by the header.
  The file position after this call is unspecified.
docstr_tok: ["Read","the","shape","of","the","array","described","by","the","header",".","The","file","position","after","this","call","is","unspecified","."]
code: def shape_from_header(self, hdr):
      """Read the shape of the array described by the header.
      The file position after this call is unspecified.
      """
      mclass = hdr.mclass
      if mclass == mxFULL_CLASS:
          shape = tuple(map(int, hdr.dims))
      elif mclass == mxCHAR_CLASS:
          shape = tuple(map(int, hdr.dims))
          if self.chars_as_strings:
              shape = shape[:-1]
      elif mclass == mxSPARSE_CLASS:
          dt = hdr.dtype
          dims = hdr.dims
  
          if not (len(dims) == 2 and dims[0] >= 1 and dims[1] >= 1):
              return ()
  
          # Read only the row and column counts
          self.mat_stream.seek(dt.itemsize * (dims[0] - 1), 1)
          rows = np.ndarray(
              shape=(),
              dtype=dt,
              buffer=self.mat_stream.read(dt.itemsize),
          )
          self.mat_stream.seek(dt.itemsize * (dims[0] - 1), 1)
          cols = np.ndarray(
              shape=(),
              dtype=dt,
              buffer=self.mat_stream.read(dt.itemsize),
          )
  
          shape = (int(rows), int(cols))
      else:
          raise TypeError("No reader for class code %s" % mclass)
  
      if self.squeeze_me:
          shape = tuple([x for x in shape if x != 1])
      return shape
  
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 8 for calling the VarReader4 obj's underlying member method code with example usage: obj.shape_from_header(hdr) and returns: shape, 