Indexing with { } gives you the contents of the cell, while indexing with ( ) returns the same type as the original object, i.e. if A is a cell, A{i,j} will return what it holds, and A(i,j) will always return the cell. You need the last.
So, in your case, you can do the following to exclude all columns where the first row has 0 .
A(:, cellfun(@(x)x==0, A(1,:))) = [];
It is assumed that each cell in the first row contains only one numeric element according to your comment.
abcd
source share