Skip to main content
2 of 3
deleted 13 characters in body
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456

Using jVincent's ContextScope[]

m`str1 = "y = 0.97*x1 + 0.521*x2 - 30.21 - 0.07431*x3 - 0.126*x4 - 0.1939*x5 - 0.361*x6";
ContextScope["m`", {SymbolName /@ Variables@#, 
                    Coefficient[#, Variables@#]} &@ToExpression[str1] // Transpose]
(*
{{"x1", 0.97`}, {"x2", 0.521`}, {"x3", -0.07431`}, 
 {"x4", -0.126`}, {"x5", -0.1939`}, {"x6", -0.361`}}
*)
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456