ismembertol second output specification
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
The command ismembertol it looks if elements of the first array belong to the second array with tolerance.
The second output argument LocB returnes which element of the second array elements of the fisrt array belong to.
"LocB — Locations in B
vector | matrix | cell array
Locations in B, returned as a vector, matrix, or cell array. LocB contains the indices to the elements (or rows) in B that are found in A (within tolerance). LocB contains 0 wherever an element in A is not a member of B.
If OutputAllIndices is true, then ismembertol returns LocB as a cell array. The cell array contains the indices for all elements in B that are within tolerance of the corresponding value in A. That is, each cell in LocB corresponds to a value in A, and the values in each cell correspond to locations in B."
It doesn't however specify which of indices is selected when OutputAllIndices is false (default).
From my test it seems returns the index of the element that has smallest distance ('byRow' is off), in case of draw then it returns the first one as showed here:
[tf, iB] = ismembertol(0, [1 1 1], 2, 'DataScale', 1)
[tf, iB] = ismembertol(0, [1 0.5 0.2], 2, 'DataScale', 1)
[tf, iB] = ismembertol(0, [1 0.2 0.6], 2, 'DataScale', 1)
[tf, iB] = ismembertol(0, [0.2 1 0.5], 2, 'DataScale', 1)
[tf, iB] = ismembertol(0, [1 0.2 0.2], 2, 'DataScale', 1)
My questions are:
- do I miss the specification written somewhere?
- What happens for when 'byRow' is true?
Of course I can turn on 'OutputAllIndices' then postselect which index of B I want. But I prefer not to if the standard output already meets my need.
- Any comment?
4 Commenti
dpb
il 21 Ago 2023
Modificato: dpb
il 21 Ago 2023
I was simply carrying on with the inferences that could be drawn (however tenuously) from the initial statement that "ismembertol is similar to ismember."
It does seem quite peculiar that the statement regarding which is returned in events of ties that is in ismember doc was dropped from ismembertol, however. I've almost never used it and didn't recall having noticed that prior to Bruno's pointing it out here.
Risposte (1)
Vedere anche
Categorie
Scopri di più su Data Import from MATLAB in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
