Writing a matrix as column vectors

조회 수: 33(최근 30일)
Nusti
Nusti 2012년 6월 19일
Hello! If I have a m x n matrix Y, how do I represent it in matlab as Y = [y1, ...., yn], where y1,...., yn are column vectors?
Is it Y = [y1:yn] ? But then, how do I define the column vectors so that matlab recognizes it?
  댓글 수: 1
the cyclist
the cyclist 2012년 6월 19일
It is unclear to me what you mean when you say "represent" and "recognize". Do you have the matrix Y already, and you are trying to create separate variable y1, y2, ..., yn? Or do you have the individual columns in variable y1, y2, .... yn already, and you want to concatenate them into one matrix?
Or is it something else that you are trying to do?

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

답변(2개)

Kevin Holst
Kevin Holst 2012년 6월 19일
If Y is a workspace variable that is an m x n matrix, then you can extract the column vectors by: y1 = Y(:,1); etc. Is that what you're trying to do?
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 6월 19일
... with all of those variables created automatically in the workspace, numbered sequentially, and with the matrix width variable so a variable number of those individually-named variables would have to be created...

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


Walter Roberson
Walter Roberson 2012년 6월 19일
You asked about this before. The answer is "Please don't do that!" http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F
And please do not delete your Questions once someone has answered them. You can edit a Question for clarification, but please do not delete it. For example, the information I posted about the possibilities of the symbolic toolbox was potentially of use to other people.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by