# Extracting a range of data from a table

I have text file with data in 2 columns. I have imported it using the following line

c = Import["ab", "Table"];


This text file has a large amount of data, and I need only a certain range. What I mean is, if my data runs for example from -10 to +10, I need only from -5 to +5 and its corresponding values.

So I naively tried this

Plot[c, {-5, 5}]


which is clearly wrong, and its little wonder that I am getting an error message.

-
Hello, your approach is no so bad. But assuming this data is a coordinate list you have to use ListPlot and with given PlotRange it will work. However, it does not affect your data but only the plotted area. –  Kuba Aug 27 '13 at 7:40
@Kuba Thanks! I tried this PlotRange -> { {-5, 5}, {-10, 10} } and it works. Turns out with the first set ie {-5, 5} I can manipulate the x axis,and with the second, the y axis. –  NutCase Aug 27 '13 at 9:45

You can use Select like this:

data = Table[{i, RandomReal[1]}, {i, 10}]


filtered = Select[data, (.1 < #[[2]] < .5) &]


ListLinePlot[filtered, Mesh -> All, MeshStyle -> Red]


or

ListLinePlot[{data, filtered},PlotLegends -> {"original", "filtered"}, Joined -> True]


-
@Nasser- Thanks..:) –  NutCase Aug 27 '13 at 9:46