When was the 'stable' option introduced in unique()?

7 vues (au cours des 30 derniers jours)
DGM
DGM le 10 Août 2025
Modifié(e) : Walter Roberson le 11 Août 2025
The option wasn't available in R2009b, but it is present in R2015b. My release notes go from to R2012b to present, and it's not mentioned in there. I know the 'legacy' option was introduced in R2012b, but there's no mention of 'stable'. I have to conclude it was sometime in after R2009b and before R2012b.
Any recollections?
  7 commentaires
DGM
DGM le 10 Août 2025
Yeah, I saw that, but I also need to re-sort the IC index list to match. I just haven't had enough contiguous moments of attention to actually think about it.
DGM
DGM le 10 Août 2025
I swear it's like I forgot that ismember() exists.
% some inputs
V0 = rand(15,3);
V0 = V0(randi([1 10],10,1),:); % points
F0 = [1 2 3; 4 5 6; 7 8 9]; % row subscripts in V0
% this is what i need to replicate
[V1,~,ic0] = unique(V0,'rows','stable');
F1 = ic0(F0);
% this is it replicated without 'stable'
[~,ia,ic] = unique(V0,'rows');
[ias sortmap] = sort(ia);
[~,ics] = ismember(ic,sortmap);
V2 = V0(ias,:);
F2 = ics(F0);
% they match
isequal(V1,V2)
ans = logical
1
isequal(F1,F2)
ans = logical
1

Connectez-vous pour commenter.

Réponse acceptée

Stephen23
Stephen23 le 10 Août 2025
Modifié(e) : Walter Roberson le 11 Août 2025
  1 commentaire
DGM
DGM le 10 Août 2025
Your search-fu is stronger than mine. Thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Historical Contests dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by