Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个具有以下结构的矩阵
X Y ID 1 2 10 15 20 2
我想根据 ID 列查找行的索引。请给我建议。
使用find:
find
ind = find(M(:,3) == id)
您可以添加'first'或'last'喜欢find(M(:,3) > id, 'first').
'first'
'last'
find(M(:,3) > id, 'first')