How to put vectors inside a matrix
이전 댓글 표시
For example, I have 100 vectors. I want to put all 100 vectors inside a 10X10 matrix.
댓글 수: 1
Ben11
2014년 8월 28일
Do you mean you have 100 1x1 vectors?
채택된 답변
추가 답변 (1개)
Aline
2014년 8월 28일
Do you want to create a 3D Matrix?
A way to do that (although possibly not the fastest) would be in a for loop and allocating each vector at a time.
You can assign the vector to the 3rd dimension like this:
A(ii,jj,:) = v1;
Though, depending on what you want to do with the vectors later, it might be easier to access them in a cell array.
C = {v1, v2; v3, v4}
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!