Strange results from unique
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
David Winthrop
am 27 Mai 2021
Bearbeitet: David Winthrop
am 27 Mai 2021
I recently encountered a strange result that defies explanation. I took a screenshot. How can this be?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/633145/BAD_MATLAB.png)
1 Kommentar
the cyclist
am 27 Mai 2021
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.
Akzeptierte Antwort
Walter Roberson
am 27 Mai 2021
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 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots 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!