0
$\begingroup$

I'm attempting to create a grid of models by datasets checkboxes with labels on the the top and bottom(with an empty in the top left corner), but I am struggling to get the moving pieces working together.

Manipulate[
onoff,
{{onoff, Table[1, Length[models]]}, ControlType -> None},
Dynamic[Panel[Grid[{mlabels,
    Outer[Checkbox[Dynamic[onoff[[#1]]], {0, 1}] &, 
     Range[Length[models]]]}
   ]]]
]

This works great for creating a list of checkboxes with Length[models], but I can't seem to find a way to change this from an array of Length[models] to a grid of size Length[models]x[Length[datasets]

mlabels in this would be the labels on top, and I would use datasets for the labels along the vertical.

$\endgroup$
1
  • $\begingroup$ Please provide examples of the undefined variables (models, mlabels, datasets) and some form of mockup to show what you are expecting as a result. $\endgroup$
    – Bob Hanlon
    Feb 2, 2023 at 20:07

1 Answer 1

2
$\begingroup$

Taking a stab at something that might kinda sorta be what you want...

Let's start off with some fake data and some helpers.

datasetValues = ConstantArray[0, {3, 5}];
controls = 
  Array[
    Checkbox[Dynamic[datasetValues[[##]]], {0, 1}] &, 
    Dimensions[datasetValues]];
DatasetLabel[n_] := "dataset_" <> ToString[n];
ParameterLabel[n_] := "param_" <> ToString[n];

Now create a grid of the controls, a place for the dynamic dataset values to display, and some very rough formatting.

Panel[
  Column[
    {Grid[
       PadLeft[
         controls, 
         Dimensions@controls + {1, 1}, 
         Prepend[
           Array[DatasetLabel[#1] &, {Length@controls, 1}], 
           Prepend[Array[ParameterLabel, Last@Dimensions@controls], Null]]],
       Spacings -> 2],
     Dynamic[TableForm[datasetValues, TableSpacing -> {5, 8}]]},
    Right,
    2]]

enter image description here

$\endgroup$

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.