Create matrix of vector from 3 differents cell array

2 次查看(过去 30 天)
Hi,
I have the followinf three cell arrays
a = {[1 0 1 0 1 0 0 0 1 1] , [1 1 1 0 0 0 1 0 1 0 1], [1 0 1 0 1 0 1 1 1 1 0 0 0 0]};
b = {[1 0 1 1 1 0 1 0 0 1] , [1 0 0 0 0 0 1 1 1 0 1], [1 1 1 1 1 0 1 0 0 1 0 0 0 0]};
c = {[1 0 1 1 1 0 1 0 0 1] , [1 0 0 0 0 0 1 1 1 0 1], [1 1 1 1 1 0 1 0 0 1 0 0 0 0]};
I would like to create new cell arrays. the number of cell arrays to be created are equal to length(a).
The first cell array should contain the first arrays of each cell arrays
A = {[1 0 1 0 1 0 0 0 1 1], [1 0 1 1 1 0 1 0 0 1], [1 0 1 1 1 0 1 0 0 1]}
The second cell array should contain the second arrays of each cell arrays
B = {[1 1 1 0 0 0 1 0 1 0 1], [1 0 0 0 0 0 1 1 1 0 1], [1 0 0 0 0 0 1 1 1 0 1]}
The third cell array should contain the third arrays of each cell arrays
C = {[1 0 1 0 1 0 1 1 1 1 0 0 0 0], [1 1 1 1 1 0 1 0 0 1 0 0 0 0] , [1 1 1 1 1 0 1 0 0 1 0 0 0 0]}
How can I do to obtain this result?
The length of a should vary, so it's necessary a loop that consider how many arrays are contained in a.

采纳的回答

madhan ravi
madhan ravi 2019-8-1
W = cellfun(@(x,y,z) {x,y,z},a,b,b,'un',0) % W{1} is A and so on

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by