Matt
Matt

Reputation: 157

How to removing entries satisfying given criteria from an array (MatLab)

I have a cell A whose entries are polynomials such as

A{1} = DocPolynom([1 2 3]). 

I would like to remove those entries i of A for which length(double(A{i})) ~=2.

How can I do this?

Thanks

Upvotes: 0

Views: 190

Answers (1)

Oli
Oli

Reputation: 16065

You should try:

inds2remove=cellfun(@(x) length(double(x))~=2,A);
A( inds2remove )=[];

Upvotes: 2

Related Questions