How can I create a loop that will generate the amount of points that exist in between specific values?
2 次查看(过去 30 天)
显示 更早的评论
I have a dataset of event times that is generated in 1 row in an array. Essentially, the appearance of a -1 in this row signifies the end of that trial, and each other number is an event in that trial. For example,
FSpks = [4, 5, 6, 6.5, -1, 2, 4, 5, 6, -1, 1, 3, 4, -1, 4, 5, 6, -1]
How would I be able to generate a loop, or a function, that would generate the amount of events that occurred in each trial?
Thanks
0 个评论
采纳的回答
Walter Roberson
2019-9-6
FSpks = [4, 5, 6, 6.5, -1, 2, 4, 5, 6, -1, 1, 3, 4, -1, 4, 5, 6, -1];
numevents_in_trial = diff([0 find(FSpks == -1)]) - 1;
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Electrophysiology 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!