Latest Date Entry Record

8 次查看(过去 30 天)
I have a large data set that contains multiple tests for the same pieces of equipment over many years. How can I isolate the latest test results only for the various pieces of equipment? There is a date stamp and equipment id and test results.
For example, for motor X, what are the last or current oil reports and ignore previous old test.
  2 个评论
KL
KL 2017-11-22
how do you store your data?
Faustino Quintanilla
I have the information in a table. The table is updated daily with new test information.

请先登录,再进行评论。

采纳的回答

KL
KL 2017-11-22
use sortrows,
sortedTable = sortrows(yourTable,'timestampColumnName')
  6 个评论
Faustino Quintanilla
Here is the code used. Where do I add the T1(end,:)?
for x=1:height(sortedTable)
T1 = sortrows(sortedTable(sortedTable.position_id==x,:),'sampledt_MAIN');
end
KL
KL 2017-11-27
Alright, you're extracting it for all equipments, so
T_latest = table;
for x=1:height(sortedTable)
T1 = sortrows(sortedTable(sortedTable.position_id==x,:),'sampledt_MAIN');
T_latest = [T_latest; T1(end,:)];
end
now, T_latest should have the last entries corresponding to all x.

请先登录,再进行评论。

更多回答(1 个)

Faustino Quintanilla
I get an error... "Subscript indices must either be real positive integers or logicals." The intent is remove duplicate rows that have a older date stamp.. How to I correct the error?

类别

Help CenterFile Exchange 中查找有关 Data Types 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by