How to concatenate 3D cells arrays

3 ビュー (過去 30 日間)
Mori
Mori 2016 年 7 月 9 日
コメント済み: Mori 2016 年 7 月 9 日
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 件のコメント
Mori
Mori 2016 年 7 月 9 日
編集済み: Mori 2016 年 7 月 9 日
3 arrays with 11 cells each with 61 cells, array A with 2252, B with 700, C with 1000 doubles.
I want an array with 11 cells, each 61 cell each with (2252+700+1000) doubles. first 11 cells is in Y direction, next 61 cells are in X direction and doubles are in Z direction.
*Yes, you right I noticed my figure is not illustrate my problem. Here is the update of the figure. Sorry about that.
Mori
Mori 2016 年 7 月 9 日
Indeed keeping the cell array format and line up the doubles at each cell

サインインしてコメントする。

採用された回答

per isakson
per isakson 2016 年 7 月 9 日
編集済み: per isakson 2016 年 7 月 9 日
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
&nbsp
"next 61 cells are in X direction" &nbsp replace 61,1 by 1,61
"doubles are in Z direction" &nbsp I don't understand what you mean.
  1 件のコメント
Mori
Mori 2016 年 7 月 9 日
GREAT! it works, Thank you

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 7 月 9 日
C = cat(3, A, B);
  1 件のコメント
Mori
Mori 2016 年 7 月 9 日
This is not the one I want. let say A{1,1} has and matrix of [100,1] and B{1,1} has a matrix of [20,1] and so on. with CAT i get 2 sheets but what I need all recorded in on sheet at the same index map. For C{1,1} i want a matrix of [120,1]. thank you

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by