select a row in a matrix based on jump in value

조회 수: 3 (최근 30일)
Atique Malik
Atique Malik 2020년 3월 24일
댓글: Ameer Hamza 2020년 3월 25일
I have a matrix of data. 9 columns and 5000 rows. The columns represent time series data.
The third column is a variable that comes alive asynchronously. It is an output from a variable that is sampled less frequently than all the others.
I want to keep only those complete rows where this variable changes value.
In practice, the slowly sampled variable is a lab analyser which keeps outputting analogue concentration values which change infrequently. The other variables are temperature readings from an experiment.
Thanks for the help
  댓글 수: 1
Sriram Tadavarty
Sriram Tadavarty 2020년 3월 24일
Just to get the clarification, you wanted the rows in which third column is alive?

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

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 3월 24일
Try this. Here M is your 5000*9 matrix
idx = [true; diff(M(:,3)) ~=0];
M = M(idx, :);
  댓글 수: 2
Atique Malik
Atique Malik 2020년 3월 25일
Thank you. That works!
Ameer Hamza
Ameer Hamza 2020년 3월 25일
Glad to be of help.

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

추가 답변 (0개)

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by