# Enter numbers into a an already existing list

How can the user enter specific numbers to a an already existed list using InputField, for example:

list1 = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}}


and the user wants to input 55 instead of 5, and 88 instead of 8.

Another example:

list = {};

DynamicModule[{x},
Column[
{InputField[Dynamic[x], String],
Dynamic @
Refresh[If[x != "", AppendTo[list, x]; x = "";]; "", TrackedSymbols :> {x}],
Button["Reset", list = {}]}]]

Dynamic[list]


The previous code allows the user to input numbers into a new list (by pressing Tab after writing them in the input field). I want the same way of entering numbers, but into an already existing list.

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Jul 30, 2016 at 22:26
• How general a list do you expect to be handled? Will the lists be constrained to being matrices as you show in your example? Or do you want to be able to edit lists of arbitrary shape? Jul 30, 2016 at 23:50
– Mark
Jul 30, 2016 at 23:52

The simplest way is just

data = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}};
InputField[Dynamic[data]]


Dynamic[data]


{{1, 2, 3, 4, 55}, {6, 7, 88, 9, 10}}

• Thank you so much but is there a way to do it by using the indices of the list?
– Mark
Jul 31, 2016 at 7:59

Perhaps, something like:

inpF = DynamicSetting[Map[InputField[#, FieldSize -> 2, Alignment -> Center]&, #, {-1}]] &;


Use it as (Ctrl+Shift+Enter to evaluate in place after highlighting the right hand side):

• thanks for your reply.. but the user should make this change by using InputField not manually.
– Mark
Jul 30, 2016 at 22:52
• @Mark, welcome to mma.se. I don't understand using InputField not manually.
– kglr
Jul 30, 2016 at 23:01
• I added another example to my question. Please check the new modification
– Mark
Jul 30, 2016 at 23:18