problem while using 'intersect' between strings

10 visualizaciones (últimos 30 días)
Yu Li
Yu Li el 8 de Oct. de 2019
Comentada: Star Strider el 8 de Oct. de 2019
Hi:
I have two strings:
s1='bound10-wall1.out'
s2='bound10-wall24.out'
[C,ia,ib] = intersect(s1,s2, 'stable');
the result is:
C='bound10-wal.t'
however, I think the expected result should be:
'bound10-wall.out'
so I would like to know if there is any mistake with my understanding?
Thanks!
Yu

Respuesta aceptada

Star Strider
Star Strider el 8 de Oct. de 2019
The letter ‘l’ appears twice in both strings, so is only returned once in the intersect result.
Yopu will get a similar result with:
s1u = unique(s1, 'stable')
s2u = unique(s2, 'stable')
and for the same reason.
  2 comentarios
Yu Li
Yu Li el 8 de Oct. de 2019
thank you.
Star Strider
Star Strider el 8 de Oct. de 2019
As always, my pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Numeric Types en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by