Matrix formed by Vectors?Easy question.
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a matrix size=10x10. And I want to obtain each column as a vector. Or vectors will create a matrix. How can I do that? Thanks in advance.
댓글 수: 0
채택된 답변
Bjorn Gustavsson
2013년 7월 16일
Yup, simple:
M =randn(10);
for i1 = 1:size(M;2)
V{i1} = M(:,i1);
end
Then you have your vectors in the cells of V.
The other direction:
M = [v1,v2,v3,....,vN];
There vN has to be column vectors.
HTH
댓글 수: 0
추가 답변 (1개)
Azzi Abdelmalek
2013년 7월 16일
v=[1 2 3;4 5 6;7 8 9]
v1=v(:,1) % first column
v2=v(:,2)
v3=v(:,3)
% horizontal concatenation
v=[v1 v2 v3]
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!