Return unique items from two matrix
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Alex Freeman
le 15 Oct 2018
Commenté : Alex Freeman
le 26 Oct 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 commentaires
Réponse acceptée
Akira Agata
le 15 Oct 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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!