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일

1 개 추천

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개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품

릴리스

R2018b

태그

질문:

2018년 10월 15일

댓글:

2018년 10월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by