フィルターのクリア

corresponding elements of a setdiff of another variable

2 ビュー (過去 30 日間)
Bharat
Bharat 2015 年 7 月 14 日
編集済み: Andrei Bobrov 2015 年 7 月 14 日
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

採用された回答

Andrei Bobrov
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 ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by