0

read some related posts and found no solution. For a list defined like this

m = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9, 1.0, 1.5, 1.6};

when I define this function

f[m__] :=m[[Range[2, Length[Evaluate[m]], 1]]] = {{r, x, y, u, v, n, l, w, 
  s}, m[[Range[2, Length[Evaluate[m]], 1]]]}\[Transpose];

I get an error telling me the list in the part assignment is not a symbol.

I want to be able to build a function that does the operation on different lists and takes the name of the list as an argument.

Carl Lange
  • 13,065
  • 1
  • 36
  • 70
Ruth Lazkoz
  • 466
  • 2
  • 8

1 Answers1

1
f2[list_] := Transpose[{{r, x, y, u, v, n, l, w, s}, list[[2 ;;]]}]

f2[m]

{{r, 0.3}, {x, 0.4}, {y, 0.5}, {u, 0.6}, {v, 0.7}, {n, 0.9}, {l, 1.}, {w, 1.5}, {s, 1.6}}

MelaGo
  • 8,586
  • 1
  • 11
  • 24