MATLAB: Resizing cells in a cell array

cells cell array dimensions

Hi guys,
I have a problem concerning cells. Lets say I have a cell array which has 9 cells within, it looks like that:
znaki =
Columns 1 through 7
[50x226 logical] [15x226 logical] [40x28 logical] [40x27 logical] [39x22 logical] [40x22 logical] [40x21 logical]
Columns 8 through 9
[40x22 logical] [40x24 logical]
What I'd like to know is how to delete the cells which dimensions are:
– rows should be less than 50 – columns should be less than 40.
So then it should delete these cells: [50×226 logical] [15×226 logical].
Thanks for help!

Best Answer

Let C be your cell array
D = C(~cellfun(@(x) size(x,1) < 50 && size(x,2) < 40,C))