Dear all, I got an output file with me which contains total 1000 numbers in it.I need to filter according to following CRITERIS .. KINDLY SUGGEST

1 view (last 30 days)
Dear all, I got an output file with me which contains total 1000 numbers in it.I need to pick the first 50 numbers and remove the next 50 upto the end(i.e. pick 1-50 aNd remove 50-100,again pick 100-150 and remove 150-200 and goes on upto 1000..)Kindly suggest how to do this using matlab.

Answers (1)

Guillaume
Guillaume on 24 Mar 2015
The mod function is your friend:
indices = 1:1000;
validindices = indices(mod(indices-1, 100) < 50);
datatokeep = data(validindices)
Note that I assume you want to keep elements 101-150 and not 100-150.
  2 Comments
Ajay Parottil
Ajay Parottil on 24 Mar 2015
consider the following numbers.[.2,.8,55,67,689,47,105,.3,.45,67] sir kindly 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]

Sign in to comment.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!