apostrophe after linspace code
Bill Denney
bill at denney.ws
Thu Jun 12 22:21:07 CDT 2008
Siddhartha wrote:
> can anyone tell me the significance of having the apostrophe
> ' after a line of code?
>
> something like this:
>
> x = linspace(0,100,100)';
>
> What is the difference between having that and leaving it
> out? I can't tell, so any help would be great!
>
Hi Siddhartha,
The apostrophe is the transpose operator. What it does in the above
line is that it turns the row vector into a column vector. If you use
single number indexing ("x(2)") and are going to iterate through the x
vector, it may not matter which you use. If you use two number indexing
("x(2,1)") or if you are going to use it for some linear algebra
operations, then there is a difference between the two.
Have a good day,
Bill
More information about the Help-octave
mailing list