is not equal in cellarray
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
how to make a not equal if statement in cellarray?
I tried this one:
for i=1:length(levelxxx)
if ~isequal(levelxxx{i},level1_root)
levelxxx(i,:)=[];
end
end
but it is not working!!
2 Kommentare
Jan
am 4 Nov. 2012
Whenever you write "is not working" in a forum, it is useful and recommended to explain, what actually happens: do you get an error message (if so, post a complete copy of the message) or do the results differ from your expectations?
Akzeptierte Antwort
Matt J
am 4 Nov. 2012
Maybe this?
idx = ismember(levelxxx(:,1),level1_root,'rows');
levelxxx= levelxxx(idx,:);
Weitere Antworten (1)
Azzi Abdelmalek
am 4 Nov. 2012
Bearbeitet: Azzi Abdelmalek
am 4 Nov. 2012
when the condition is true :
levelxxx(i,:)=[];
then the size of levelxxx will be reduced!
use
v_temp=levelxxx
for i=1:length(v_temp)
if ~isequal(v_temp{i},level1_root)
levelxxx(i,:)=[];
end
end
3 Kommentare
Azzi Abdelmalek
am 5 Nov. 2012
Bearbeitet: Azzi Abdelmalek
am 5 Nov. 2012
I did a big mistake, try Simon's code. And post a sample of your data
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!