How can I create a loop for transpose row vector to column vector
Mostrar comentarios más antiguos
Hi guys!
I have a data 4624X12 and i need transpose every line to columns, to getting a 55488X1 matrix.
I tried the following loop:
j=1; [row,col]=size(data); for i=1:row M(j)=data(i,:)'; j=j+1 end
This error appier in this situation: "??? In an assignment A(I) = B, the number of elements in B and I must be the same"
Tks every budy!
Respuesta aceptada
Más respuestas (2)
Shashank Prasanna
el 14 de Mayo de 2013
>> newdata = reshape(data,55488,1)
Jan
el 14 de Mayo de 2013
0 votos
The error message explains exhaustively, why M(j)=data(i,:)' must fail: There is a vector on the left side, but a scalar on the right side. Obviously you cannot assign the values of a vector to one scalar.
Roger's answer solves the problem efficiently.
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!