Union of two matrices with different column size

2 ビュー (過去 30 日間)
Dario
Dario 2017 年 12 月 15 日
編集済み: Stephen23 2017 年 12 月 15 日
I need to make the union between two matrices:
M 455799x3
N 771719x3
I attach the workspace with the two matrices inside. What I have to do is to insert the values that are in the 3rd column of M in the 3rd column of N. The first 2 columns of both the matrix represent X coord and Y coord but the problem is that the coordinates of the matrices are not in the same order.

採用された回答

Stephen23
Stephen23 2017 年 12 月 15 日
編集済み: Stephen23 2017 年 12 月 15 日
>> [idm,idn] = ismember(M(:,1:2),N(:,1:2),'rows');
>> N(idn,3) = M(idm,3);
Note that the provided data are floating point, so you should definitely read this:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by