Return unique items from two matrix

2 次查看(过去 30 天)
Here are 2 matrix... (shape is 4 items in each entry and 5 entries). I want the unique entries. So for
>> f(:, 11:15)
ans =
24.1326 25.2125 25.2125 25.8147 25.8147
311.1230 418.3029 418.3029 329.6527 329.6527
2.0453 2.1123 2.1123 2.0111 2.0111
-3.2076 0.8975 -4.1030 -1.6351 -2.5608
>> g(:, 11:15)
ans =
25.2125 25.2125 25.8147 25.8147 26.1735
418.3029 418.3029 329.6527 329.6527 448.4572
2.1123 2.1123 2.0111 2.0111 2.0753
0.8975 -4.1030 -1.6351 -2.5608 -1.0299
The 2 unique items in the two matrix are ... (first entry in f)
24.1326
311.1230
2.0453
-3.2076
and (last entry in g)
26.1735
448.4572
2.0753
-1.0299
How can I find the unique items please?

采纳的回答

Akira Agata
Akira Agata 2018-10-15
How about this?
h = setxor(f',g','rows');
h = h';
The result is:
>> h
h =
24.1326 26.1735
311.1230 448.4572
2.0453 2.0753
-3.2076 -1.0299

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by