I want user to input a matrix. I have the below code for this.
rmatrix = {{Input["r11"], Input["r12"]}, {Input["r21"], Input["r22"]}}
But it shows a separate dialog for each item. I want to get the complete matrix in one dialog.
I also tried it in another way. check the code below.
form = FormFunction[{{"r11" -> "Number",
"r12" -> "Number"}, {"r21" -> "Number", "r22" -> "Number"}},
MatrixForm];
But I don't know how to assign these values to matrix.
rmatrix = DialogInput[{r11, r12, r21, r22}, Grid[{
{"r11", InputField[Dynamic[r11], Number], "r12",
InputField[Dynamic[r12], Number]},
{"r21", InputField[Dynamic[r21], Number], "r22",
InputField[Dynamic[r22], Number]},
{
Button["done", DialogReturn[{{r11, r12}, {r21, r22}}],
ImageSize -> Automatic]}}]];
If you do like this it won't let you exit without entering all the values:
rmatrix = DialogInput[{r11, r12, r21, r22}, Grid[{
{"r11", InputField[Dynamic[r11], Number], "r12",
InputField[Dynamic[r12], Number]},
{"r21", InputField[Dynamic[r21], Number], "r22",
InputField[Dynamic[r22], Number]},
{ Button["done", DialogReturn[{{r11, r12}, {r21, r22}}],
ImageSize -> Automatic,
Enabled -> Dynamic[AllTrue[{r11, r12, r21, r22}, NumericQ]]]}}]];