I recently encountered a strange result that defies explanation. I took a screenshot. How can this be?

댓글 수: 1

the cyclist
the cyclist 2021년 5월 27일
It's always better to upload the data and code, rather than an image (which we cannot work with).
Yes, someone might be able to eyeball what is going on, but usually not.

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2021년 5월 27일

0 개 추천

XLv{1} is a vector of 702 elements, YLv{1} is a vector of 702 elements. When you combine them you get 702 unique rows. But that does not imply that there are no duplicates amongst Xlv{1] or YLv{1} .
1 3
1 4
2 3
2 4
4 unique rows, right?
Now let XLvs be [1 2] and YLvs be [3 4]. ismember([1 1 2 2], [1 2]) would be [true true true true], ismember([3 4 3 4], [3 4]) would be [true true true true]. & the two of them to get [true true true true], which has a sum of 4... even though there are only 2 unique values in each of XLvs and YLvs.

댓글 수: 1

David Winthrop
David Winthrop 2021년 5월 27일
편집: David Winthrop 2021년 5월 27일
Ah, I see that what I really wanted, since these are coordinate sets, is:
ismember([Xlv{1},Ylv{1}],[XLvs,YLvs],'rows')
This gives the expected result of length 85.
Thanks! I did not know ismember could match rows that way.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2021년 5월 27일

편집:

2021년 5월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by