function G = distspike(S,cost)
% G = distspike(S,cost) computes the pairwise distance matrix of a set of spike trains
% Input: S [nx1] is a cell containing spike timing arrays e.g. S{1} = [0.01 0.55 0.93];
% cost is the q parameter for the Victor-Purpura distance, default 1
% Output: G is the resultant [nxn] distance matrix
if nargin == 1
cost = 0.1;
end
d = length(S);
G = zeros(d);
for count1 = 1:d
for count2 = count1 + 1:d
G(count1,count2) = spkd(S{count1},S{count2},cost);
G(count2,count1) = G(count1,count2);
end
end