is not equal in cellarray
14 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Jan
2012 年 11 月 4 日
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?
採用された回答
Matt J
2012 年 11 月 4 日
Maybe this?
idx = ismember(levelxxx(:,1),level1_root,'rows');
levelxxx= levelxxx(idx,:);
その他の回答 (1 件)
Azzi Abdelmalek
2012 年 11 月 4 日
編集済み: Azzi Abdelmalek
2012 年 11 月 4 日
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 件のコメント
Azzi Abdelmalek
2012 年 11 月 5 日
編集済み: Azzi Abdelmalek
2012 年 11 月 5 日
I did a big mistake, try Simon's code. And post a sample of your data
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!