MATLAB: How to save all the data

save all data

I am using this code to search for a word in a cell, and save all the row:
D=alldata(:,1:5);
idx = cellfun('isclass',D,'char');
idx(idx)=~cellfun('isempty',regexp(D(idx),'BATTERY')) ;
data = alldata(any(idx,2),:);
and I want to save the not " battery" cells (the rest of the file)
so I use:
Notdata = X(~idx,:);
but it didn't work…:(
what is wrong?

Best Answer

For no obvious reason you removed the any from my answer:
Notdata = X(~any(idx,2),:);