What is the best way to define an output vector in this case?

1 view (last 30 days)
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?

Accepted Answer

David Hill
David Hill on 20 Jun 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 Comments
alpedhuez
alpedhuez on 20 Jun 2022
As another extention, suppose each iteration now gives a 10*10 matrix (not just a 10 dimensional vector). Then how can one define an output vector in such a situation?

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!