Arrays

I have 'n' number of column vectors of size 3000.
I want to put these 'n' column vectors in a matrix like this
X = [n1 n2 n3 ...];
Any help is appreciated. Thanks
Edit I have an image matrix converted to vector. I have around 300 Image vectors now. I have to make a complete array with having all those 300 vectors. In that matrix there should be 1 column of each image vector. here n1 is my first image vector, n2 is second image vector and so on.

2 comentarios

David Young
David Young el 5 de Dic. de 2011
How are the column vectors stored or accessed?
David Young
David Young el 5 de Dic. de 2011
If they're stored as variables n1, n2 etc., what is the problem with the code you give in your question?

Iniciar sesión para comentar.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 5 de Dic. de 2011

0 votos

4 comentarios

Ahmad
Ahmad el 5 de Dic. de 2011
This solves a problem bit but I want matrix with vectors so that I can multiply that matrix with its transpose. The answer you mentioned creates cells and its not allowing me to multiply with its transpose because they are cells with matrices in it.
Any ways thanks.
Walter Roberson
Walter Roberson el 5 de Dic. de 2011
Don't create those variables n1, n2, n3, and so on, to begin with. If you put them all in a cell array, n{1}, n{2}, n{3} etc, then you can use [n{:}] to construct the array you want. But it depends on whether your n1, n2 and so on are row vectors or column vectors, which you do not say. If they are row vectors then you need to transpose them, but probably easier then would be to use vertcat(n{:}) and then transpose that result.
Sean de Wolski
Sean de Wolski el 5 de Dic. de 2011
How about cell2mat (if all of the cells are the same size)
Ahmad
Ahmad el 6 de Dic. de 2011
Thanks for the help Walter Roberson. :)

Iniciar sesión para comentar.

Más respuestas (1)

Robert Cumming
Robert Cumming el 5 de Dic. de 2011

0 votos

help reshape

2 comentarios

Ahmad
Ahmad el 5 de Dic. de 2011
I have an image matrix converted to vector. I have around 300 Image vectors now. I have to make a complete array with having all those 300 vectors. In that matrix there should be 1 column of each image vector. here n1 is my first image vector, n2 is second image vector and so on.
Robert Cumming
Robert Cumming el 5 de Dic. de 2011
http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer

Iniciar sesión para comentar.

Categorías

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by