could anyone help me how to convert the values in cell array into double.
6 views (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Walter Roberson
on 25 Jun 2021
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
temp = cell2mat(cellfun(@(M) M', A, 'uniform', 0))
A1 = temp(:,1)
A2 = temp(:,2)
More Answers (0)
See Also
Categories
Find more on Data Types in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!