Effacer les filtres
Effacer les filtres

Compact the values in a string

1 vue (au cours des 30 derniers jours)
pamela sulis
pamela sulis le 18 Mar 2016
Hi! I have a string '641 617 674 674 631 631 631 631 654 629 625 625 673 674': I want to delete duplicate. Ex
'641 617 674 674 631 631 631 631 654 629 625 625 673 674'
will became
'641 617 674 631 654 629 625 673 674'
can you help me?

Réponse acceptée

the cyclist
the cyclist le 18 Mar 2016
Here's one way:
s = '641 617 674 674 631 631 631 631 654 629 625 625 673 674';
unique_s = num2str(unique(str2num(s),'stable'))

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by