apostrophe after linspace code
Marc Normandin
mnormand at iupui.edu
Thu Jun 12 21:51:19 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!
>
> THanks,
> Siddhartha Owens
Hi Siddhartha,
The apostrophe acts as the transpose operator, flopping rows for columns
and columns for rows. In your example, the act of transposing simply
turns a row vector (see variable y below) into a column vector.
octave:1> x = linspace (0, 100, 100)';
octave:2> y = linspace (0, 100, 100);
octave:3> whos x y
*** local user variables:
Prot Name Size Bytes Class
==== ==== ==== ===== =====
rwd x 100x1 800 double
rwd y 1x100 800 double
Regards,
Marc
--
------------------------------------------------------------------
Marc D. Normandin http://web.ics.purdue.edu/~mdnorman
Graduate Research Assistant mnormand at iupui.edu
Indiana University School of Medicine 317-278-9841 (tel)
Department of Radiology, Division of Research 317-274-1067 (fax)
------------------------------------------------------------------
More information about the Help-octave
mailing list