New Reply

problem with lists

 
Share Thread Thread Tools
Aug9-12, 06:49 AM   #1
 

problem with lists


hi
I have a list which I want to drop some of it's rows
and I have the id of the rows I want to drop in a list and there's no algorythem in the list

how can I do that?
I know the Command Drop[MC, {id}] whould drop the row number id but if I put this in a loop and try to drop them one by one the id's whould change since i'm dropping some rows and I tried to figure a way out of it but the just didn't work, any help?

the first one in my list and the second one the id of the rows to be dropped

PHP Code:
{{0.004149386.}, {0.004380525.9}, {0.004608425.8}, {0.00482298
  
5.7}, {0.00500975.6}, {0.005154075.5}, {0.00517174
  
5.4}, {0.005048645.3}, {0.004698235.2}, {0.00402235
  
5.1}, {0.00294495.}, {0.001654984.9}, {-0.00110326
  
4.8}, {-0.005569294.7}, {-0.01130294.6}, {-0.0183193
  
4.5}, {-0.02589244.4}, {-0.03638154.3}, {-0.0540341
  
4.2}, {-0.07629134.1}, {-0.09781724.}, {-0.120518
  
3.9}, {-0.154793.8}, {-0.1883653.7}, {-0.221846
  
3.6}, {-0.2506253.5}, {-0.2835683.4}, {-0.276114
  
3.3}, {-0.2275463.2}, {-0.1291613.1}, {0.0897719
  
3.}, {0.5119112.9}, {1.198762.8}, {2.323582.7}, {4.16475
  
2.6}, {7.021932.5}, {11.43462.4}, {18.22262.3}, {28.5117
  
2.2}, {44.05892.1}, {67.33992.}, {""""}} 
PHP Code:
{2345789101213141517181920222426,
28303234363840
 
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> 'Whodunnit' of Irish potato famine solved
>> The mammoth's lament: Study shows how cosmic impact sparked devastating climate change
>> Curiosity Mars rover drills second rock target
Aug9-12, 07:59 PM   #2
 
Quote by raymound View Post
if I put this in a loop and try to drop them one by one the id's would change since i'm dropping some rows
What if your loop drops them one by one starting with the end of your list instead of the beginning?

First drop row 40 and then drop row 38 and then drop row 36 ... and then drop row 2.

The number of rows remaining in your list would decrease with each iteration, but by doing this in reverse order of the id's that you still need to delete would not change.
 
New Reply
Thread Tools


Similar Threads for: problem with lists
Thread Forum Replies
If I have a list that contains 16 sublist (enclosed in 2 curly Math & Science Software 4
Problem with iterator for vector of lists in c++ Programming & Comp Sci 2
Simple problem in Mathematica involving lists Math & Science Software 3
linked lists Introductory Physics Homework 1