There is InputField in mma but how to make InputTable? In MathCAD it`s possible to insert Excel spreadsheet with input and output variables.Input variables I use for filling of header row and column and output variable for output. How to make the same functionality in mma? Thanks in advance

  • $\begingroup$ Thanks for the accept, but there's no need for speed. It's better to give it a few hours or even days, so that more answers come in. $\endgroup$ Commented Sep 16, 2012 at 15:15
  • $\begingroup$ This MathCAD feature is very good but nothing like it exists built in to Mma. The closest is TableView which @SjoerdC.deVries has shown below. It is undocumented and falls way short of the MathCAD implementation. Fingers crossed for a full documented and better version for V9. $\endgroup$ Commented Sep 16, 2012 at 22:46

1 Answer 1

nrows = 3; ncols = 4;
t = ConstantArray[0, {nrows, ncols}];
it = Table[With[{i = i, j = j}, InputField[Dynamic[t[[i, j]]]]], {i,nrows}, {j, ncols}];


Mathematica graphics

Another dynamic view to show it works:

Transpose[t] // TableView // Dynamic

(the Transpose here just used to show it actively uses the input).

Mathematica graphics

Please note that I used the undocumented TableView to make it more Excel-like, but I noticed that cell selection is a bit sluggish and/or unpredictable. You may want to change to Grid instead, which seems to work better.

  • $\begingroup$ @NasserM.Abbasi As you can see in the figures it is quite possible to enter data in all the rows (I work on the same platform as you), but there is a good reason for my advice to use Grid. $\endgroup$ Commented Sep 16, 2012 at 15:12
  • 3
    $\begingroup$ Dangerous to rely upon undocumented (even unreliable) TableView. It would be really convenient if TableView were implemented reliably and with documentation in a future Mathematica version, but that's something we cannot count on, of course. So Grid is probably better to use for now. $\endgroup$
    – murray
    Commented Sep 16, 2012 at 15:23
  • $\begingroup$ But inputed values dissapear after recalculation of notebook?! $\endgroup$ Commented Sep 16, 2012 at 16:27
  • $\begingroup$ @SergeyFomin Did you notice the line: t = ConstantArray[0, {nrows, ncols}]; in the code? What do you think it does? $\endgroup$ Commented Sep 16, 2012 at 18:30
  • $\begingroup$ It initialize the array t of course.But I need to keep inputed values.I guess it`s obvious thing or no? $\endgroup$ Commented Sep 16, 2012 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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