Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to filter the data as given below?

1 回表示 (過去 30 日間)
Ajay Parottil
Ajay Parottil 2015 年 3 月 24 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
consider the following numbers.[.2,.8,55,67,689,47,105,.3,.45,67] kindly some one suggest me a program to pic the first two and remove next two..so my answer should be likely [.2,.8,689,47,.45,67]

回答 (1 件)

Guillaume
Guillaume 2015 年 3 月 24 日
The answer is exactly the same as your previous question. Use mod:
data = [.2,.8,55,67,689,47,105,.3,.45,67];
indices = 1:numel(data);
indices = indices(mod(indices-1, 4) < 2);
data(indices)
You need to take the time to understand the answers you're given.
  2 件のコメント
Ajay Parottil
Ajay Parottil 2015 年 3 月 25 日
Thanks for your valuable suggestions.I understood the logic sir.But actually i got 1018536 values.and i need to pick the first 16428 and remove the next 16428 values........upto the last.The current logic will not work in it.The data file is also attached..Kindly suggest
Guillaume
Guillaume 2015 年 3 月 25 日
You can change the number of values you want to pick and discard as much as you want, the logic is still the same. You just have to change the ratio for the modulo operation. (hint: it's twice the number of values you want to keep).

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by