Retrieving elements of a cell array at regular set intervals

3 views (last 30 days)
Hey all! I'm currently working on a project where I have a cell array called spiketimes. Spiketimes basically contains information on when a particular spike (from a neural recording) occurs. As a result ,all the elements of the spiketimes cell array contains time points say 0.1 secs, 0.2145 secs and can go upto 4.27 secs etc. So for that particular timepoint, a spike occurs and counts as 1 count of a spike. Now what I want is to count the number of spikes for every 0.1 secs from the cell array. In other words I want to count the number of elements of the cell array between 0.1 and 0.2, 0.2 and 0.3 and so on till the last element of the array. What might be the best way to go about it?
Thanks in advance!

Answers (1)

Swatantra Mahato
Swatantra Mahato on 8 Jul 2021
Edited: Swatantra Mahato on 8 Jul 2021
Hi,
It is my understanding that you want to determine the number of elements in your array that meet a certain condition. In this case, you may want to look into logical indexing on arrays in MATLAB.
You can refer the documentation link below to get started on logical indexing
Note that, you may need to convert your cell array into a matrix using the "cell2mat" function in order to use logical operators.
Hope this helps

Tags

Community Treasure Hunt

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

Start Hunting!