I don't understand what this u(:,1) does to matrix or vector?

Hi
What does the following notation mean
u(:,1)
Does it covert a row vector to a column vector?
Thanks

 採用された回答

pfb
pfb 2015 年 4 月 27 日
編集済み: pfb 2015 年 4 月 27 日

0 投票

It gives you the first column of the array u.
If u is a row vector, that is the 1st element.
if u is a column vector, that is the entire vector.
If you want to transform a row vector into a column, see u', transpose(u), or u(:).

4 件のコメント

DM
DM 2015 年 4 月 27 日
thanks, By array you mean a matrix right?
pfb
pfb 2015 年 4 月 27 日
編集済み: pfb 2015 年 4 月 27 日
yes.
Note that u' and transpose(u) have different effects for complex numbers.
DM
DM 2015 年 4 月 27 日
I have also come across the following notation x(:)? Do you know what it means?
Stephen23
Stephen23 2015 年 4 月 28 日
The syntax x(:) creates a column vector out of x, regardless of the shape of x. Here is some documentation and examples:

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

質問済み:

DM
2015 年 4 月 27 日

コメント済み:

2015 年 4 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by