MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Existence of a column in a table in an if loop


Dear Mathgroup,
I have the following problem:
when I do mean = Mean[Table[s5[[i, 5]] for some data the last column doen't exists, how can i ask the program to compute the mean only if the column exists.
Thanks,
Best regards,
Maria

data5 = {{50315, "111063"}}

Do[
 ID = data5[[i, 2]];
 s = Import[
   "http://www.swift.ac.uk/xrt_curves/00"; <> ID <> "/curve2.qdp",
   "Text"];
 background = StringPosition[s, "! PC background data"][[1, 1]];
 s1 = StringDrop[s, background];
 s2 = StringPosition[s1, "NO NO NO NO NO NO"][[1,=0A 1]];
 s3 = StringDrop[s1, -s2];
 s4 = Export["s3.txt", s3, "Table"];
 s5 = Import["s3.txt", "Table"];
 mean = Mean[Table[s5[[i, 5]], {i, 3, Length[s5]}]],
 {i, 1, Length[data5]}]


  • Prev by Date: OpenCL OpenCLFractalRender3D invalid binary error
  • Next by Date: Re: new functional operator
  • Previous by thread: Re: OpenCL OpenCLFractalRender3D invalid binary error
  • Next by thread: Using Mathematica to typeset books