I have a matrix with data in one column and corresponding time intervals in the next column. Another matrix has event times. I am wanting to get the data from the first matrix that corresponds to the event time. I feel like this is simple, but I am having issues choosing the right way to go about this. The data is continuous so I want to make sure that I am getting a good approximation of the data when event times are between intervals.

댓글 수: 4

per isakson
per isakson 2016년 4월 2일
편집: per isakson 2016년 4월 2일
How is "the event time" related to "time intervals" ? Show smalls samples of the two matricies.
please post your both matrix?
Krispy Scripts
Krispy Scripts 2016년 4월 4일
In first column of matrix1 is frequency data and in the second column is regular intervals of time that correspond to the frequency data. Matrix2 is time points of events that correspond to the time from matrix1. I want to take the frequency data points from matrix1 based on the events that are happening in matrix2.
Krispy Scripts
Krispy Scripts 2016년 4월 4일
The time stamps in column 2 of matrix1 and event times in matrix2 are directly related

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

 채택된 답변

Star Strider
Star Strider 2016년 4월 5일

0 개 추천

There are only three rows that exactly correspond:
D1 = load('Heath Robinson Matrix1.mat');
D2 = load('Heath Robinson Matrix2.mat');
M1 = D1.Matrix1;
M2 = D2.matrix2;
[CommonTimes, ia, ib] = intersect(M1(:,2),M2);
DesiredResult = M1(ia,:)
DesiredResult =
0.0027084 0.045775
-0.083389 0.23977
0.051537 0.25477

댓글 수: 4

Krispy Scripts
Krispy Scripts 2016년 4월 5일
I am looking to take data points from matrix1 for every event happening in matrix2. So its a continuous data set and I need the corresponding data point in matrix1 based on matrix2 time events
Star Strider
Star Strider 2016년 4월 5일
Those in my Answer are the only ones that exactly correspond, since that is what you stated you wanted in your Question.
If you have different criteria, you need to state them specifically in terms that are possible to code. We can’t guess what you’re thinking.
Krispy Scripts
Krispy Scripts 2016년 4월 6일
My apologies, I did not ask correctly. I accepted this as an answer because you did what I asked.
Would you mind taking a look at this question again that I posted here:
My apologies again and thank you for the help you already gave.
Star Strider
Star Strider 2016년 4월 6일
My pleasure.
I left a Comment requesting further clarification, since it’s still not clear to me.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2016년 4월 2일

댓글:

2016년 4월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by