フィルターのクリア

Find values outside of a range when calculating residuals.

7 ビュー (過去 30 日間)
BOB
BOB 2017 年 12 月 3 日
コメント済み: Star Strider 2017 年 12 月 3 日
Hi, I'm trying to find all my residuals above 3 and below minus 3 and extract the corresponding records to an excel sheet. I know there are 447 values which are outside of the range out of the total 14792.
My approach has been to use the find function to find all records within the range and then somehow make it so matlab returns all records outside this range, but I'm not familiar with how to do this and so was hoping for some help here.
The code I have so far is simply:
W=find(res>=-3 & res<3)
>> length(W)
ans =
14345
Where length(W) is the number of records within the range 3 to -3, whereas I need the other 447 values outside of this range.
The variable res is a 14972 x 1 double
Thanks for any help.
  2 件のコメント
ANKUR KUMAR
ANKUR KUMAR 2017 年 12 月 3 日
Do you want to extract those values which lies between -3 and 3 and write in the excel file?
BOB
BOB 2017 年 12 月 3 日
I want any records with residuals that do not lie in the range 3 to -3 thanks, so essentially the opposite.

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2017 年 12 月 3 日
I would use ‘logical indexing’ here:
L = (res>=-3) & (res<3); % Logical Index Of ‘res’ Values Within Limits
In = W(L);
Out = W(~L);
If you need the indices, use find:
InIdx = find(L);
OutIdx = find(~L);
  2 件のコメント
BOB
BOB 2017 年 12 月 3 日
Thanks!
Star Strider
Star Strider 2017 年 12 月 3 日
My pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by