Concatenate rows of cell into one column
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    AM
 el 24 de Oct. de 2018
  
    
    
    
    
    Comentada: Benjamin Azrieli
 el 11 de Nov. de 2020
            Hello,
I have one cell A of size nxm and I would like to convert it into a cell of size nx1. For example if
A= { [1] [2] [3] [4] [5]
    [6] [7] [8] [9] [10]}
I want
C= { [1 2 3 4 5]
     [6 7 8 9 10]}
I tried
for i=1:n
     C{i,1} = A{i,:};
end
but this only gives me the first value of A per line
I don't know how to do this, any help is appreciated!
0 comentarios
Respuesta aceptada
Más respuestas (1)
  madhan ravi
      
      
 el 24 de Oct. de 2018
        
      Editada: madhan ravi
      
      
 el 24 de Oct. de 2018
  
      A= { [1] [2] [3] [4] [5]
    [6] [7] [8] [9] [10]}
c = (cell2mat(A))
C = [{c(1,:)} ;{c(2,:)}]
celldisp(C)
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!



