필터 지우기
필터 지우기

How do you select elements of one cell array based on the contents of another cell array?

조회 수: 3 (최근 30일)
Hey all! I have two cell arrays, "spiketimes" and "eyetimes". Both of them contain elements which are essentially time points at which an event occurs. Now, I'm using the following lines of code to select elements of "eyetimes" based on the value of "spiketimes"
idx = ismembertol(eyetime,spiketimes,0.02, 'DataScale',1 );
eyetime = eyetime(idx);
Elaborating on the code a bit further, the index selects elements of "eyetime" for each value of "spiketime" with an interval of 0.02 secs. For eg, if an element of "spiketimes" is 0.250, it'll select all elements of "eyetime" between 0.250+0.02 & 0.250-0.02. I want to modify this code to only select elements of "eyetimes" before 0.250 i.e 0.250-0.02 only. How would I go about executing this? Thanks in advance!

답변 (1개)

Jonas
Jonas 2021년 7월 8일
lower your aim value by half your error interval and half your error interval
-> 0.250-(0.02/2)+0.02/2 & 0.250-(0.02/2)-0.02/2
  댓글 수: 2
Kevin Akash Rajasekaran
Kevin Akash Rajasekaran 2021년 7월 8일
Alright I see, but that's just for one value right? How do I go about extending this to the rest of the "spiketimes" array?
Jonas
Jonas 2021년 7월 8일
create another version of spiketimes in which all elements are lowered by 0.02/2

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by