% The script calculates the Inter Spike Intervals (ISIs) and plots the % results in a histogram. The proportion of ISIs violating a threshold % is also calculated and indicated in the histogram. % authors: Francesco E. Vaccari % date: 10/2022 clear all; clc; close all; addpath('supportFunctions') currentFolder = pwd; parentFolder = fileparts(fileparts(currentFolder)); [filename,path_folder_data] = uigetfile('*.h5','Select a h5 dataset',[parentFolder '\data']); str = '/DATA'; %it can be either unit_XXX, unit_XXX/condition_YY or unit_XXX/condition_YY/trial_ZZ threshold = 1; %threshold for violations in ms [data, all_strings] = get_all_data_from_level_h5_rec([path_folder_data filename],str, {}, {}); %extract data spikes = data(:,2); ISIs = cellfun(@diff, spikes, 'UniformOutput', false); ISIs = cell2mat(ISIs'); violations = length(find(ISIs