This code implements a coupled markov model for analysis of positive or negative ion channel coupling from measured unitary currents in patch clamp recordings see our paper: Spatial Coupling Tunes NMDA Receptor Responses via Ca2+ Diffusion Gary J. Iacobucci and Gabriela K. Popescu Journal of Neuroscience 6 November 2019, 39 (45) 8831-8844; DOI: https://doi.org/10.1523/JNEUROSCI.0901-19.2019

This code is run by running the `ChannelCouplingAnalysis.m`

file which calls the others.

```
%%%%%%%INPUT VARIABLES:
%coupling_type - specify whether you are analyzing channels that are
%positively or negatively coupled. Enter 1 for positive coupling and 2 for
%negative coupling
%method - specify the method of analyzing the transition probability matrix
%(eg. by sequence of state transitions (where all diagonal elements = 0) or
%by time-series (state at each sampled time point)). Enter 1 for time-series
%method or enter 2 for state-sequence method.
%deadtime - enter the deadtime in the form of sample point number. must be
%a whole integer. a value of 1 implies no imposed deadtime.
%%%%%% OUTPUT VARIABLES:
%Results - will contain the results of the fitted parameters from the
%'channelcoupling.m' script for each file. Fitted parameters are based on
%the notation from Chung and Kennedy, 1996 and Moreno et al. 2016 eLife
% output.k - coupling coefficient
% output.r - open-to-open probability
% output.z - closed-to-closed probability
%%%%% HOW TO USE
%prior to running this script, you will need to create an array named 'fileID' containing
%the file names of the files you will analyze. This program is written to
%accept files in the DWT format from QUB software that expresses state
%index and corresponding dwell time in column format.
%
%example array format:
%
% fileID = {'file0.dwt';
% 'file1.dwt';
% 'file2.dwt';
% 'file3.dwt';
% 'file4.dwt';
% 'file5.dwt'};
%
%Example command line input to run script:
% [Results] = ChannelCouplingAnalysis(2, 1, 1);
```