Finding data points of two different matrices based off of time
Mostra commenti meno recenti
I have one matrix with data in the first column and time stamps in the second column (datamatrix.mat). The next matrix contains spiketimes (spiketimematrix.mat). I want to get the data point in the first column of first matrix that is the closest time point corresponding to the spike times in spiketimematrix.mat. For example, the first spiketime is 166.1670, which corresponds to the closet time point of 166.1696 and corresponds with the data point 2.5281. I have tried using the following code:
for k=1:length(spiketimesmatrix)
dataout(k)=datamatrix(find(spiketimesmatrix>=datamatrix(:,2),1);
end
I keep getting the first data point as the entire dataoutput.
Not sure if this is clear enough.
1 Commento
Krispy Scripts
il 26 Ott 2016
Risposta accettata
Più risposte (1)
Walter Roberson
il 25 Ott 2016
dataout(k)=datamatrix(find(spiketimesmatrix(k)>=datamatrix(:,2),1);
Categorie
Scopri di più su R Language in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!