MATLAB Answers

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

로그인 to comment.

채택된 답변

Walter Roberson
Walter Roberson 6 Sep 2019
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개)

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그


Translated by