Percentage of a value in a table rows matlab
    1 visualización (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Jonas Damsbo
 el 28 de Nov. de 2018
  
    
    
    
    
    Respondida: Guillaume
      
      
 el 28 de Nov. de 2018
            Hi
I want to find a certain value in each row in a table. An example:
[3 5 4 6 2 7 5 11 12 2; 1 4 3 6 7 5 3 7 12 10 15; 6 8 7 9 4 12 12 6 7 9]
So if I looking for the percentage of the value 12 I want to get the output:
[10; 10; 20] 
Any way to do that?
0 comentarios
Respuesta aceptada
  Guillaume
      
      
 el 28 de Nov. de 2018
        A = [3 5 4 6 2 7 5 11 12 2; 1 4 3 6 7 5 3 7 12 10; 6 8 7 9 4 12 12 6 7 9] 
sum(A == 12, 2) / size(A, 2) * 100
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Tables 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!
