loop for extracting columns of a matrix
조회 수: 2 (최근 30일)
이전 댓글 표시
I would like to know how to do a loop to extract all the columns from a matrix and generate individual vectors
Thanks to all
댓글 수: 2
Adam
2015년 4월 21일
What are you going to do with the individual vectors when they are no longer in the matrix?
Almost certainly anything you want to do would be better off having them all within the matrix and run whatever your vector-based operation is in a for loop if it cannot be vectorised.
답변 (1개)
Chris McComb
2015년 4월 21일
If you have a matrix, M, you can access column i (as a vector) by using M(:, i).
(The colon indicates 'every row')
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!