select a row in a matrix based on jump in value
3 次查看(过去 30 天)
显示 更早的评论
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
2020-3-24
Just to get the clarification, you wanted the rows in which third column is alive?
采纳的回答
Ameer Hamza
2020-3-24
Try this. Here M is your 5000*9 matrix
idx = [true; diff(M(:,3)) ~=0];
M = M(idx, :);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!