Effacer les filtres
Effacer les filtres

Create matrix of vector from 3 differents cell array

3 vues (au cours des 30 derniers jours)
luca
luca le 1 Août 2019
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.

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by