Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I would like to have 4 output fields for something like the following:

Manipulate[
n*x
n/x
n + x
n - x,
{n, 1, 10}, {x, 1, 10}, ControlType -> InputField]

but this just outputs all 4 calculations combined.

share|improve this question
3  
Try something like this: Manipulate[ Row[{n*x, "," , n/x, ",", n + x ",", n - x}], {n, 1, 10}, {x, 1, 10}, ControlType -> InputField] –  Artes Dec 15 '13 at 18:58
    
Brilliant - thank you :) –  martin Dec 15 '13 at 19:01
    
Although this question arises from a simple mistake, I recommend that it not be closed because this is common problem for beginners, and the question and its answer is likely to help future visitors with a similar problem. –  m_goldberg Dec 15 '13 at 19:33
1  
@m_goldberg but then the title should be improved. Perhaps: "manipulate with multiple outputs"? Of course the main problem here is not Manipulate, but CompoundExpression (and the fact that it is not needed in top level notebook cells) –  Ajasja Dec 15 '13 at 22:19
    
Related: Multiple output cells. One of the answers contains an answer to this question. –  Michael E2 Dec 15 '13 at 22:52
show 1 more comment

1 Answer

up vote 6 down vote accepted

As mentioned in the comment by Artes, you can use Row, although you don't need to put in the "," individually. Row takes a spacing element as its second argument.

Manipulate[Row[{n*x, n/x, n + x, n - x}, ", "],
  {n, 1, 10},
  {x, 1, 10},
  ControlType -> InputField]

manip.png

You can get much fancier, of course. For example:

Manipulate[Column[{
   Row[{"n*x = ", n*x}],
   Row[{"n/x = ", n/x,}],
   Row[{"n + x = ", n + x}],
   Row[{"n - x = ", n - x}]}],
 {n, 1, 10},
 {x, 1, 10}, ControlType -> InputField]

manip2.png

For the ultimate in layout control, take a look at Grid.

share|improve this answer
    
Thank you - this is really helpful :) –  martin Dec 15 '13 at 19:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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