How can I find a faster way to calculate the transpose of a matrix?
    6 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Benson Gou
      
 el 28 de Jun. de 2021
  
    
    
    
    
    Respondida: Rik
      
      
 el 28 de Jun. de 2021
            Dear All,
I have a matrix A and I want to select some columns from A to form another matrix B, and calculate the sum of each columns in B. I did this way:
B = A(:,Cols)'; Where Cols are the selected columns. 
eee = sum(B); 
It took more than 3 seconds to do this. I am wondering if there is a fastr way to do it. 
Thanks a lot. 
Benson
0 comentarios
Respuesta aceptada
  Rik
      
      
 el 28 de Jun. de 2021
        The transpose is not required. You can use the second input to sum to change dimension along which it operates.
Also, an absolute time depends on the data and the computer, so without that information, it is meaningless. If you want specific help, you should post more code so we can reproduce the behavior.
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Startup and Shutdown 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!

