How to combine two one dimensional cell arrays into one two-dimensional cell array?
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Magdalena Kachlicka
el 18 de Jul. de 2022
Comentada: Magdalena Kachlicka
el 18 de Jul. de 2022
Hello everyone,
I'm trying to combine two (1x20) cell arrays called semVector and onsetVectors (same dimensions), each containing n x 1 sized numerical array into one (1x20) cell array that would now include values from both cell arrays and be of size n x 2.
For example, the created variable bothVectors would be of size 1 x 20 and bothVectors{1,1} would have two columns (11308 x 2), the same as bothVectors{1,2} = (11550 x 2) etc.
Somehow everything I've done so far just concatenates them into either 2 x 1 cell or 1 x 40 cell.
Any help please?
0 comentarios
Respuesta aceptada
Stephen23
el 18 de Jul. de 2022
Where A and B are your cell arrays:
C = cellfun(@horzcat,A,B,'uni',0)
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!