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

 Accepted Answer

pfb
pfb on 27 Apr 2015
Edited: pfb on 27 Apr 2015
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 Comments

thanks, By array you mean a matrix right?
pfb
pfb on 27 Apr 2015
Edited: pfb on 27 Apr 2015
yes.
Note that u' and transpose(u) have different effects for complex numbers.
I have also come across the following notation x(:)? Do you know what it means?

Sign in to comment.

More Answers (0)

Categories

Tags

Asked:

DM
on 27 Apr 2015

Commented:

on 28 Apr 2015

Community Treasure Hunt

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

Start Hunting!