4
$\begingroup$

I have a table:

Table I want to be editable

I want it to be editable only where the zeros appear. I read this post Generating an editable table that can be used as input because it's almost exactly what I want, but I couln't figure out how to keep uneditable the first column AND the first row. I don't show the modifications I did because they wouldn't shed any light.

$\endgroup$
5
$\begingroup$

I'll show you hoe to do it for a 3 x 3 matrix of values. You should be able to extend to 3 x 12 without much trouble

First do some initialization.

headers = {"Jan", "Feb", "Mar"};
rowLbls = {" ", "Tmax", "Tmed", "Tmin"};
valTbl = ConstantArray[0, {3, 3}];

Next build the spreadsheet.

MapThread[Prepend, 
  {
    Prepend[
      Array[InputField[Dynamic@valTbl[[#1, #2]], Number, FieldSize -> Tiny] &, {3, 3}],
      headers],
   rowLbls
  }] // TableForm

spreadsheet

Finally a place to view the changes to valTbl as they occur.

Dynamic @ valTbl
{{0, 0, 0}, {0, 42, 0}, {0, 0, 0}}
$\endgroup$
1
  • $\begingroup$ That's what I was looking for. Thanks! $\endgroup$ Jun 13 '14 at 0:27

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.