loop for extracting columns of a matrix

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
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.
I would like to use the cftool and dependent variables in my fits are in matrix columns
Many thanks

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

답변 (1개)

Chris McComb
Chris McComb 2015년 4월 21일

0 개 추천

If you have a matrix, M, you can access column i (as a vector) by using M(:, i).
(The colon indicates 'every row')

댓글 수: 1

Thanks Chris, this I know, but I would like to use a loop for doing it in one go for all the columns...if this is possible

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

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2015년 4월 21일

댓글:

2015년 4월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by