How to concatenate 3D cells arrays
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mori
el 9 de Jul. de 2016
Comentada: Mori
el 9 de Jul. de 2016
Here I am posting my question graphically to illustrate better my question.
I have 2 3D cell array (A, B) with the same cell sizes and different lengths. I want to Concatenate A and B in order to get C which has same cell size but longer length.
7 comentarios
Respuesta aceptada
per isakson
el 9 de Jul. de 2016
Editada: per isakson
el 9 de Jul. de 2016
Try
>> R = cssm()
R =
{61x1 cell}
{61x1 cell}
{61x1 cell}
{61x1 cell}
{61x1 cell}
{61x1 cell}
{61x1 cell}
{61x1 cell}
{61x1 cell}
{61x1 cell}
{61x1 cell}
>> R{1}{1}
ans =
Columns 1 through 14
1 2 3 4 5 6 7 8 9 1 2 3 4 5
Columns 15 through 18
6 1 2 3
>> R{11}{61}
ans =
Columns 1 through 14
1 2 3 4 5 6 7 8 9 1 2 3 4 5
Columns 15 through 18
6 1 2 3
and
>> tic, R = cssm(); toc
Elapsed time is 0.008893 seconds.
where
function R = cssm( )
A = (1:9);
A = repmat( {A}, [61,1] );
A = repmat( {A}, [11,1] );
B = (1:6);
B = repmat( {B}, [61,1] );
B = repmat( {B}, [11,1] );
C = (1:3);
C = repmat( {C}, [61,1] );
C = repmat( {C}, [11,1] );
R = cell( 11, 1 );
for jj = 1 : 11
D = cell( 61, 1 );
for ii = 1 : 61
D{ii} = cat( 2, A{jj}{ii}, B{jj}{ii}, C{jj}{ii} );
end
R{jj} = D;
end
end
 
"next 61 cells are in X direction"   replace 61,1 by 1,61
"doubles are in Z direction"   I don't understand what you mean.
Más respuestas (1)
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!