could anyone help me how to convert the values in cell array into double.

1 ビュー (過去 30 日間)
jaah navi
jaah navi 2021 年 6 月 25 日
コメント済み: jaah navi 2021 年 6 月 25 日
I am having cell array A=9x1 cell as
2x1 double - A{1,1} [1;2]
2x1 double - A{2,1} [5;6]
2x1 double - A{3,1} [8;5]
2x2 double - A{4,1} [1,3;5,6]
2x2 double - A{5,1} [5,4;7,8]
2x2 double - A{6,1} [2,6;9,6]
2x3 double - A{7,1}[1,2,3;4,4,6]
2x3 double - A{8,1}[5,6,7;8,9,1]
2x3 double - A{9,1}[2,3,4;5,6,7]
I want to convert into two separate matrix as
A1, A2
[1 [2
5 6
8 5
1 5
3 6
5 7
4 8
2 9
6 6
1 4
2 4
3 6
5 8
6 9
7 1
2 5
3 6
4] 7]
Could anyone please help me on this to do.

採用された回答

Walter Roberson
Walter Roberson 2021 年 6 月 25 日
A{1,1} = [1;2];
A{2,1} = [5;6];
A{3,1} = [8;5];
A{4,1} = [1,3;5,6];
A{5,1} = [5,4;7,8];
A{6,1} = [2,6;9,6];
A{7,1} = [1,2,3;4,4,6];
A{8,1} = [5,6,7;8,9,1];
A{9,1} = [2,3,4;5,6,7];
A
A = 9×1 cell array
{2×1 double} {2×1 double} {2×1 double} {2×2 double} {2×2 double} {2×2 double} {2×3 double} {2×3 double} {2×3 double}
temp = cell2mat(cellfun(@(M) M', A, 'uniform', 0))
temp = 18×2
1 2 5 6 8 5 1 5 3 6 5 7 4 8 2 9 6 6 1 4
A1 = temp(:,1)
A1 = 18×1
1 5 8 1 3 5 4 2 6 1
A2 = temp(:,2)
A2 = 18×1
2 6 5 5 6 7 8 9 6 4
  1 件のコメント
jaah navi
jaah navi 2021 年 6 月 25 日
Thanks for your help.

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

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by