フィルターのクリア

How to section a matrix?

1 回表示 (過去 30 日間)
Faustino Quintanilla
Faustino Quintanilla 2017 年 11 月 17 日
編集済み: M 2017 年 11 月 20 日
I am trying to retrieve the latest date entry formation from a table. I have changes the date to a serial number and created a separate matrix with equipment_id and serial number. There are multiple serial numbers for the equipment_id, but just need the highest serial number, since is is the date date entry.
* euip_id serial number.
* -9999866 730537
* -9999866 733865
* -9999747 731652
* -9999747 732028
* -9999747 729692
* -9999747 735361

回答 (1 件)

M
M 2017 年 11 月 20 日
編集済み: M 2017 年 11 月 20 日
Maybe using something like this :
M=[-9999866 730537;
-999986 733865;
-9999747 731652;
-9999747 732028;
-9999747 729692;
-9999747 735361];
id=-9999747; % choose an id
indices where first row of M is equal to the desired id :
index=M(:,1)==id;
index =
6×1 logical array
0
0
1
1
1
1
And take the maximum of the corresponding serial number
max(M(index,2))
ans =
735361

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by