Convert 385*360 cell array containing 1*33 vector into 1*360 Matrix containing 385*33 double
    2 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Johanna Popp
 el 22 de Dic. de 2021
  
    
    
    
    
    Comentada: Johanna Popp
 el 22 de Dic. de 2021
            Hi all, 
I am trying to convert 385*360 cell array, with each cell containing a 1*33 vector of double values, into a 1*360 cell array containing 385*33 double values. Here is the Code (+ Annotations)  that I have so far but it doesn't seem to work the way I want it to. 
Any help would be appreciated, thanks!!
for i = 1:385
    for j = 1:360
        x = Node_all{i,j} % Node_all is the Matrix size 385*360 containing 1*33 double each 
        Node_complete(i,:) = x % This is the Information from each collumn summed up in 1 Matrix (385 *33)
        All_Nodes_complete{j,1} = Node_complete % Now trying to put the 385*33 Matrix back into a cell (1*360)
    end
end
0 comentarios
Respuesta aceptada
  Voss
      
      
 el 22 de Dic. de 2021
        Here is one way to do it:
n = size(Node_all,2);
All_Nodes_complete = cell(1,n);
for j = 1:n
    All_Nodes_complete{j} = vertcat(Node_all{:,j});
end
Or another way (more like the way you were trying):
[m,n] = size(Node_all);
for j = 1:n
    for i = 1:m
%         x = Node_all{i,j}; % Node_all is the Matrix size 385*360 containing 1*33 double each 
%         Node_complete(i,:) = x; % This is the Information from each collumn summed up in 1 Matrix (385 *33)
        Node_complete(i,:) = Node_all{i,j};
    end
    All_Nodes_complete{1,j} = Node_complete; % Now trying to put the 385*33 Matrix back into a cell (1*360)
end
Más respuestas (0)
Ver también
Categorías
				Más información sobre Matrices and Arrays 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!

