EdgeCalculator(bin,​start,stop,varargin​)

extracts left-bins between starting/stopping range given a set bin width
211 Downloads
Updated 19 Feb 2016

View License

%-------function [edge,splitdata,lastbin] = EdgeCalculator(bin,start,stop,varargin)------------
%
% Calculate edge times/samples given a user-defined bin width and start/stop range.
% This is useful for things such as PSTHs, histograms, sliding averages,
% permuation entropy, etc. etc.
%
% >>> INPUTS >>>
% Required:
% bin = bin width (in samples)
% start = starting time (samples)
% stop = ending time (samples)
% Optional:
% Fs = sampling rate...useful for converting edge samples to time
% (put 0 as place holder if you want samples)
% data = data array (not matrix) to be split into segments
%
% <<< OUTPUTS <<<
% edge = edge times (in samples, seconds, or ms)
% splitdata = *optional* if input data array as optional argument,
% will split into segments of equal-sized/spaced data
% lastbin = if length(data) < stop, will find the next index
% from "edge" that can be used to parse the data (i.e. up
% to bin X).
%
% By JMS, 08/14/2015
%------------------------------------------------------------------------------------------

Cite As

Jordan Sorokin (2024). EdgeCalculator(bin,start,stop,varargin) (https://www.mathworks.com/matlabcentral/fileexchange/55489-edgecalculator-bin-start-stop-varargin), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0