Borrar filtros
Borrar filtros

Compare two different length vectors

3 visualizaciones (últimos 30 días)
jano satti
jano satti el 12 de Abr. de 2017
Respondida: Star Strider el 12 de Abr. de 2017
let say A=[2 3] and B=[3 3 2] and c=[ 10 20],now A compares the elements with B and assign values from c. Answer is D=[20 20 10] How can I do that? Thanks in Advance.

Respuesta aceptada

Star Strider
Star Strider el 12 de Abr. de 2017
Use the second output of the ismember function:
A=[2 3];
B=[3 3 2];
C=[ 10 20];
[~,idx] = ismember(B,A);
D = C(idx)
D =
20 20 10

Más respuestas (0)

Categorías

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

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by