Return unique items from two matrix
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Alex Freeman
am 15 Okt. 2018
Kommentiert: Alex Freeman
am 26 Okt. 2018
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?
0 Kommentare
Akzeptierte Antwort
Akira Agata
am 15 Okt. 2018
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!