Info

This question is closed. Reopen it to edit or answer.

remove rows by specific numbers

1 view (last 30 days)
Tiina
Tiina on 6 Feb 2012
Closed: MATLAB Answer Bot on 20 Aug 2021
I want to remove entire rows if one columns has a range of values. With loops I am running out of memory so maybe some other solution would be great (columns 1 is time columns 2 and 3 are units ) the dataset has millions of rows
90000 10 6 90001 14 8 90002 8 5 90003 11 4 90004 15 9 90005 13 4 90000 1 1.5 90001 3 2.5 90002 14 8 90003 7 4 90004 7 9
if I want to remove a range of time stamps , for simplicity say 2 of them 90001 and 90002 what is a possible solution that I can run on a normal laptop without memory issues to get an output like
90002 8 5 90003 11 4 90004 15 9 90005 13 4 90002 14 8 90003 7 4 90004 7 9
thanks

Answers (1)

Andrei Bobrov
Andrei Bobrov on 6 Feb 2012
data = reshape([90000 10 6 90001 14 8 90002 8 5 90003 11 4 90004 15 9 90005 13 4 90000 1 1.5 90001 3 2.5 90002 14 8 90003 7 4 90004 7 9],3,[])'
%solution
out = data(~ismember(data(:,1),[90000,90001]),:)

This question is closed.

Community Treasure Hunt

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

Start Hunting!