loop for extracting columns of a matrix

1 回表示 (過去 30 日間)
Pedro Roda Navarro
Pedro Roda Navarro 2015 年 4 月 21 日
コメント済み: Pedro Roda Navarro 2015 年 4 月 21 日
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.
Pedro Roda Navarro
Pedro Roda Navarro 2015 年 4 月 21 日
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 日
If you have a matrix, M, you can access column i (as a vector) by using M(:, i).
(The colon indicates 'every row')
  1 件のコメント
Pedro Roda Navarro
Pedro Roda Navarro 2015 年 4 月 21 日
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

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by