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

조회 수: 1 (최근 30일)
alpedhuez
alpedhuez 2022년 6월 20일
댓글: David Hill 2022년 6월 20일
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?

채택된 답변

David Hill
David Hill 2022년 6월 20일
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
alpedhuez
alpedhuez 2022년 6월 20일
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?
David Hill
David Hill 2022년 6월 20일
for k=1:1000
yourMatrix;
newMatrix(:,:,k)=yourMatrix;%3D matrix
end

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by