vlookup type matrix creating
    7 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Rafael Schwarzenegger
 el 13 de Feb. de 2020
  
    
    
    
    
    Comentada: Stephen23
      
      
 el 14 de Feb. de 2020
            Hello, I would like to create a vlookup (excel) type operation that searches matrix A in matrix B and creates matrix C. How could I do it please in the most easy way?
 A = [0 0 1 0.25;
      0 1 1 0.75]
 B = [0 0 1;
      0 1 1;
      0 1 1;
      0 0 1;]  
 C = [0 0 1 0.25;
      0 1 1 0.75;
      0 1 1 0.75;
      0 0 1 0.25;] 
Thank you for any ideas!
0 comentarios
Respuesta aceptada
  Steven Lord
    
      
 el 13 de Feb. de 2020
        Since this sounds like it might be a homework question, I'm only going to point you in the direction of a useful function: ismember (with the 'rows' option.)
0 comentarios
Más respuestas (1)
  Rafael Schwarzenegger
 el 14 de Feb. de 2020
        1 comentario
  Stephen23
      
      
 el 14 de Feb. de 2020
				The MATLAB way:
>> [~,X] = ismember(B,A(:,1:3),'rows');
>> C = A(X,:)
C =
   0.00000   0.00000   1.00000   0.25000
   0.00000   1.00000   1.00000   0.75000
   0.00000   1.00000   1.00000   0.75000
   0.00000   0.00000   1.00000   0.25000
Ver también
Categorías
				Más información sobre Creating and Concatenating Matrices 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!


