I have set of files say 1 to 10. Each of these files have 3 subsets like 1-0,1-1,1-2; 2-0,2-1,2-2; and so on. i.e total 30 files in all. I am using the following code to extract the information from all 0th subset:
files = Range[1, 10];
path = "D:\\20180126-";
a = Length[files];
c = path <> ToString[#] <> "-0.txt" & /@ files;
d = Table[Import[c[[i]], "Table"], {i, 1, a}];
mns[d_] = Module[{ma},
ma = Table[{
Total[d[[i]][[1000 ;; 2000]]],
Total[d[[i]][[2000 ;; 2500]]]}
, {i, 1, Length[d]}] /. {x_} :> x
]
e = mns[d]
so far so good. But when I am trying to extract the same information from subsets "1" and "2" using the following code, I am getting the same values as obtained for 0th subset.
c = path <> ToString[#] <> "-1.txt" & /@ files;
e = mns[d]
c = path <> ToString[#] <> "-2.txt" & /@ files;
e = mns[d]
Thanks in advance
mns[d_]:=...? Please lookupSetandSetDelayed. See linked topic, especially: Understand the difference between Set (or =) and SetDelayed (or :=) – Kuba Apr 09 '18 at 12:31