0
$\begingroup$

In a mathematica operation I am getting the o/p say, 1->2. For the next step, I want to use these two numbers as variables, say take them as 1 = m and 2 = n. How can I do it.

$\endgroup$
  • $\begingroup$ 1 = m is not m = 1. $\endgroup$ – Kuba Jul 26 '17 at 9:58
1
$\begingroup$
out = 1 -> 2;

{m, n} = List @@ out;

m

1

n

2

If out would be a string:

out = "1 -> 2";

{m, n} = List @@ ToExpression @ out;
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.