Could anyone please help me how to extract the desired array size inside the cell.

1 vue (au cours des 30 derniers jours)
I am a cell array
A=15x1 cell
1x1 cell-[1,2,3,4]
1x2 cell-[1,2,3] [4]
1x2 cell-[1,2,4] [3]
1x2 cell-[1,2] [3,4]
1x3 cell-[1,2] [3] [4]
1x2 cell-[1,3,4] [2]
1x2 cell-[1,3] [2,4]
1x3 cell-[1,3] [2] [4]
1x2 cell-[1,4] [2,3]
1x2 cell-[1] [2,3,4]
1x3 cell-[1] [2,3] [4]
1x3 cell-[1,4] [2] [3]
1x3 cell-[1] [2,4] [3]
1x3 cell-[1] [2] [3,4]
1x4 cell-[1] [2] [3] [4]
In this array I need to have only 1x2 cell inside which should contain only two numbers in each array i.e., [1,2] [3,4], [1,3] [2,4] and [1,4] [2,3].
Could anyone please help me on this.

Réponse acceptée

Walter Roberson
Walter Roberson le 2 Juil 2021
mask = cellfun(@(c)all(cellfun(@length, c) ==2),A)
A(mask)
The code would have to be changed if 2 2 2 can be observed

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by