how to change this matrix in this manner?
    6 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
how to manipulate this matrix without for loop:
A=[a1,b1,c1,d1.......;a2,b2,c2,d2..........;a3,b3,c3,d3.......;a4,b4,c4,d4....;..]
how to get this:
H=[a1,b1,a2,b2,a3,b3,......;c1,d1,c2,d2,c3,d3,........]
thank you
0 comentarios
Respuesta aceptada
  Iain
      
 el 22 de Mayo de 2013
        H = [reshape(reshape(A(:,1:2),[],2)',[],1);reshape(reshape(A(:,3:4),[],2)',[],1)];
0 comentarios
Más respuestas (1)
  David Sanchez
      
 el 22 de Mayo de 2013
        If you prefer an extended version:
A = rand(6); % example matrix
H = zeros(size(A,1)/2,size(A,1)*2); % initialize matrix
[n_rows n_cols] = size(A);
col = 1;
row = 1;
while col <= n_cols/2
    while row <= n_rows
        H(col,(2*row-1)) = A(row,(2*col-1));
        H(col,(2*row)) = A(row,col*2);
        row = row + 1;
    end
    col = col + 1;
    row = 1;
end
0 comentarios
Ver también
Categorías
				Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

