code: def _read_nlx_mat_chan_keep_gaps(matfile: str) -> np.ndarray:
      """Read a single channel from a Neuralynx .mat file and keep invalid samples."""
      mat = loadmat(matfile)
  
      hdr_dict = _nlxheader_to_dict(mat)
  
      # Nlx2MatCSC.m reads the data in N equal-sized (512-item) chunks
      # this array (1, n_chunks) stores the number of valid samples
      # per chunk (the last chunk is usually shorter)
      n_valid_samples = mat["NumberOfValidSamples"].ravel()
  
      # read in the artificial zeros so that
      # we can compare with the mne padded arrays
      ncs_records_with_gaps = [9, 15, 20]
      for i in ncs_records_with_gaps:
          n_valid_samples[i] = 512
  
      # concatenate chunks, respecting the number of valid samples
      x = np.concatenate(
          [
              mat["Samples"][0:n, i]
              for i, n in enumerate(n_valid_samples)
          ]
      )  # in ADBits
  
      # this value is the same for all channels and
      # converts data from ADBits to Volts
      conversionf = literal_eval(hdr_dict["ADBitVolts"])
      x = x * conversionf
  
      # if header says input was inverted at acquisition
      # (possibly for spike detection or so?), flip it back
      # NeuralynxIO does this under the hood in NeuralynxIO.parse_header()
      # see this discussion: https://github.com/NeuralEnsemble/python-neo/issues/819
      if hdr_dict["InputInverted"] == "True":
          x *= -1
  
      return x
  
file_path: mne-python/mne/io/neuralynx/tests/test_neuralynx.py
imports: import os
  from ast import literal_eval
  import numpy
  import pytest
  from numpy.testing import assert_allclose
  from scipy.io import loadmat
  from mne.datasets.testing import data_path, requires_testing_data
  from mne.io import read_raw_neuralynx
  from mne.io.tests.test_raw import _test_raw_reader
label_desc: Use image node_id 3 for calling a global function with example usage: _read_nlx_mat_chan_keep_gaps(matfile) and returns: x