how to save all the 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?

3 Comments

Could you give us a sample alldata() ?
here is a sample:
where I search for a word 'ex: battery ... ' and save ans (rows) in data
and I want to save the rest in Notdata, to be capable of start a new search in Notdata ....etc.

Sign in to comment.

 Accepted Answer

Stephen23
Stephen23 on 31 Jul 2015
Edited: Stephen23 on 31 Jul 2015
For no obvious reason you removed the any from my answer:
Notdata = X(~any(idx,2),:);

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

on 31 Jul 2015

Commented:

on 1 Aug 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!