Reputation: 301
I have a cell Array called 'MPI{216,10}', containing strings or matrix in different cells. In column 10 (MPI{:,10}), there is a matrix with three column. I want to find the matrices which sum of their third column is zero. So, I wrote:
find(sum(MPI{:,10}(:,3)) == 0)
but I am getting this error:
Expected one output from a curly brace or dot indexing expression, but there were 216 results.
Can anyone help please?
Upvotes: 1
Views: 5109
Reputation: 4974
You must use parentheses indexing for getting a slice of a cell array, then apply a function on each cell by cellfun
find(cellfun(@(x) sum(x(:,3)), MPI(:,10))==0)
Upvotes: 2