What does this prime symbol do - MATLAB?

MATLAB has several built-in functions to manipulate matrices. The special character, ', for prime denotes the transpose of a matrix.

The statement A = [ 1 2 3;4 5 6;7 8 9]' produces the matrix

A = 
   1 4 7 
   2 5 8
   3 6 9

hope this helps


From Matlab's help

help ctranspose
' Complex conjugate transpose.
X' is the complex conjugate transpose of X.

 B = ctranspose(A) is called for the syntax A' (complex conjugate
 transpose) when A is an object.

The [X ; Y] syntax concatenates two matrices vertically. So that line is adding the just-computed results to the already computed q. If you simply reassigned q, you would be discarding all the computations the function had already done each time through the loop.

The forward apostrophe ' does a complex conjugate and transposes a matrix. I would guess that distribucion_color_bin_RGB2 probably returns a real-valued column vector, and the author wanted to flip it to horizontal before appending it to the results matrix.

As @ja72 pointed out, it's better style to use .' (just transpose) by default and ' only when you actually mean a complex conjugate, even if you expect your data to be real.

Tags:

Matlab