corresponding elements of a setdiff of another variable
1 回表示 (過去 30 日間)
古いコメントを表示
Hello, I have a question about setdiff. I have three variables X ,Y, p. I need to find elements of Y excluding elements of p and corresponding elements of X (corresponding to Y). I ran the following (Both X and Y have same number of elements).
y=setdiff(Y,p);
x= X(setdiff(Y,p)); this doesn't work. Any solutions?
Thanks,
Bharat
0 件のコメント
採用された回答
Andrei Bobrov
2015 年 7 月 14 日
編集済み: Andrei Bobrov
2015 年 7 月 14 日
x = X(~ismember(Y,p));
or
[~,ii] = setdiff(Y,p);
x = X(ii);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Workspace Variables and MAT-Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!