how can i assign a full row into a new row?

1 回表示 (過去 30 日間)
wasima tammi
wasima tammi 2015 年 3 月 3 日
コメント済み: rantunes 2015 年 3 月 3 日
suppose T = [1 2 3 4; 3 4 5 6]
and i want to assign the 1st row with all the column into a new row like P and this can be as follows
P= 1 2 3 4 Q= 3 4 5 6

採用された回答

Guillaume
Guillaume 2015 年 3 月 3 日
P = T(1, :)
Q = T(2, :)
Or you could just not bother and use T(1, :) wherever you want P and T(2, :) wherever you want Q.
Note that the colon means all elements (of the row in this instance).

その他の回答 (1 件)

rantunes
rantunes 2015 年 3 月 3 日
Hey,
I am not sure if I really got your point, but what you want do is not this:
P = T(1,1:4); Q = T(1,5:8);
?
Greets
  2 件のコメント
wasima tammi
wasima tammi 2015 年 3 月 3 日
no actually i made a mistake while writing the Variables T it should be T =[1 2 3 4; 3 4 5 6]
rantunes
rantunes 2015 年 3 月 3 日
So you just need to do P = T(1,:) and Q = T(2,:).

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

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by