I want to filter a data file choosing those elements that match a condition and then plot them. Here is the corresponding code I use:
data = Import["data.out", "Table"];
pick[m_List, i_Integer] := Module[{s = m[[i, 8]]}, Pick[m, s, s != 0]];
dataP = Table[{PointSize[0.005], Red, pick[data, i],
Point[{data[[i, 3]], data[[i, 4]], data[[i, 5]]}]}, {i, 1, Length[data]}]
The module pick is supposed to choose those elements from the list m for which $s\neq 0$. However, it does not work and therefore all the elements of the list are plotted. I used also Select[m, s !=0] but with no success. What am I doing wrong?
This is a small sample of the data file
data1={{-4.05, -0.48, -1.4648, -1.36804, -1.7282, 648.01, 1.03023*10^-13, 7},
{-4.05, -0.41, -1.2762, 1.7369, 1.55982, 278.54, 1.99574*10^-14, 0},
{-4.05, -0.34, -1.54191, 1.42069, 1.59888, 178.32, 9.0609*10^-14, 5}}
s = m[[i,8]]is the element of the last (eight) column. – Vaggelis_Z Oct 12 '13 at 09:16Selectwork right inside my original module? – Vaggelis_Z Oct 12 '13 at 09:32iis a simple counter starting from 1 all the way to the end of the length of the list in order to test all the items. – Vaggelis_Z Oct 12 '13 at 09:39