What is the best way to define an output vector in this case?
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    alpedhuez
      
 el 20 de Jun. de 2022
  
    
    
    
    
    Comentada: David Hill
      
      
 el 20 de Jun. de 2022
            Suppose
- I run 1000 loops
- For each loop, I generate 10 dimensional vector as an output
- I want to create a 1000*10 dimemsional vector that records outputs from 1000 loops
- Then I want to create a histogram of the output vector, etc
What would be the best way to define an output vector in this case? 
0 comentarios
Respuesta aceptada
  David Hill
      
      
 el 20 de Jun. de 2022
        I assume you mean a 10-element vector.
for k=1:1000
    yourVector=;%computation to compute your vector
    yourMatrix(k,:)=yourVector;%this will by 1000x10 matrix containing each loop's vector
end
histogram(yourMatrix);
3 comentarios
  David Hill
      
      
 el 20 de Jun. de 2022
				for k=1:1000
    yourMatrix;
    newMatrix(:,:,k)=yourMatrix;%3D matrix
end
Más respuestas (0)
Ver también
Categorías
				Más información sobre Loops and Conditional Statements 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!

