フィルターのクリア

Simple inverse indexing question...

21 ビュー (過去 30 日間)
Mats
Mats 2012 年 4 月 19 日
Suppose you have;
t = 1:0.1:10;
x = rand(1,100);
ind = [1:10,60:61,80:100];
I want a single expression which gives all the other indexes of t or x other than 'ind'. In this case [11:59,62:79].
This can't be hard, but i just cannot seem to find the answer. The simplified reason for which this is needed is:
figure();
plot(t(ind),x(ind),'r');
plot(t(~ind),x(~ind),'b');
And I don't want new variables like x2 = x; x2(ind) = [];
Thank you in advance!

採用された回答

Mats
Mats 2012 年 4 月 19 日
Somehow the response from Andrei Bobrov got lost, but he had the answer!
setdiff(find(x),ind) of setdiff(1:length(x),ind)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by