How to compare two lists
Ahora está siguiendo esta pregunta
- Verá actualizaciones en las notificaciones de contenido en seguimiento.
- Podrá recibir correos electrónicos, en función de las preferencias de comunicación que haya establecido.
Se ha producido un error
No se puede completar la acción debido a los cambios realizados en la página. Vuelva a cargar la página para ver el estado actualizado.
0 votos
Comparte un enlace a esta pregunta
Respuesta aceptada
0 votos
Comparte un enlace a esta respuesta
19 comentarios
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
"Umer: you want to output zero if a is not a member of b, but this answer does not do that."
Huh?
>> b =[1 2 3 4 5 ]
b =
1 2 3 4 5
>> a = [1 2 7]
a =
1 2 7
>> a .* ismember(a,b)
ans =
1 2 0
Comparte un enlace a este comentario
mask = ~ismember(a, b); c = a;
then
c(mask) = 2; %change the missing items to the fixed value 2
or
c(mask) = a(mask) - 1; %change the missing items to one less than their original value
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
- if the datatypes are uint8, int16, or int32, then the code assumes you knew what you were doing with the range of values and leaves them completely unchanged
- if the range of values is -1 to +1 then the code assumes you knew what you were doing with the range of values and leaves them unchanged, but alters the datatype to double. The cases where the data type could end up altered are single() that are in the right range, and int64(). The way the code is set up cannot affect the other integer data types
- if the values are all non-negative, then the code assumes you knew what you were doing about the lower end of the values, and rescales [0 max(c)] to [-1 +1] . So, for example, your range of values happened to be 30000 to 50000 then this will be mapped first to [30000/50000, 50000/50000] and then the [0 1] range would be mapped to [-1 +1] so the [30000/50000, 50000/50000] would end up mapping to [1/5 1]. It would also have been entirely reasonable to instead map [min(c) max(c)] to [-1 +1]: in the absence of information from you about what should be done, a decision had to be made
- otherwise, in the case where there was a mix of positive and negative values but the range was outside [-1 +1], the code scales [min(c) max(c)] to [-1 +1]
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Más respuestas (0)
Categorías
Más información sobre Audio Processing Algorithm Design en Centro de ayuda y File Exchange.
Etiquetas
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
