how do i turn an array into a column vector?

594 visualizaciones (últimos 30 días)
Tom
Tom el 23 de Mayo de 2012
I can't work out how to change my array into a column vector. I thought it was just putting ' after it, but that's not working. If I had A=[1,2,3,4] how would I make that into a 4x1 column vector?
  2 comentarios
Jan
Jan el 24 de Mayo de 2012
For "A = [1,2,3,4]" inserting a ' afterwards is sufficient:
A = [1,2,3,4]'
or:
A = [1,2,3,4]; disp(A');
If this does not work for your code, please post the code and the error message.
Matt Fig
Matt Fig el 2 de Nov. de 2012
I can't work out how to change my array into a column vector. I thought it was just putting ' after it, but that's not working. If I had A=[1,2,3,4] how would I make that into a 4x1 column vector?

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 23 de Mayo de 2012
For any kind of array you get a single column vector by
A(:)
Or if you are sure that A is a row vector,
A.'
Caution: A' is the conjugate transpose and the plain transpose is A.'
  1 comentario
Tom
Tom el 24 de Mayo de 2012
great thanks walter this is exactly what i needed :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by