hi all,(adsbygoogle = window.adsbygoogle || []).push({});

i have a list of numbers as follows (list1):

22

26

51

4

740

...

and a two column list of numbers as follows (list2):

1 13

4 9

22 26

33 740

55 1234

the task i want to accomplish is as follows:

if a number from list1 is found in a row in list2, i would like to remove that row from list2. in the above example the numbers 22, 26, 4, and 740 are found in both columns of list2 and i would like to remove rows 2, 3, and 4 of list2. how would i do this in a short matlab script?

thanks!

i also have the following code from a prior implementation, but this only works for 2 column arrays. any help would be much appreciated!

kill=[];

for i=1:length(list1)

if list1(i,1) == list2(i,2)

kill = [kill i];

end

end

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MATLAB: deleting rows

**Physics Forums | Science Articles, Homework Help, Discussion**