More efficient alternative to find()
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Chun Hei Chan
 el 4 de Ag. de 2023
  
    
    
    
    
    Comentada: Chun Hei Chan
 el 4 de Ag. de 2023
            Hello,
I am working on some simulation data and I would like to find the maximum element in each randomly generated vector which has no inherent pattern. Is there any more efficient alternative to the find() function in this case since Profiler says that find() is taking up a significant proportion of the compile time.
Many thanks.
0 comentarios
Respuesta aceptada
  John D'Errico
      
      
 el 4 de Ag. de 2023
        
      Editada: John D'Errico
      
      
 el 4 de Ag. de 2023
  
      Why does max not do what you want? There are TWO returns from max.
X = randi(100,[1,10])
[xmax,maxloc] = max(X)
Más respuestas (0)
Ver también
Categorías
				Más información sobre Get Started with MATLAB 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!

