1
$\begingroup$

I have

vAwGOptns = {
             {{0}, {0}},
             {{1}, {0}},
             {{0}, {1}},
             {{1}, {1}}
            };

and would like to select one of these vectors using SetterBar

SetterBar[Dynamic[vAwG], vAwGOptns]

which works fine. In the setter bar button text, it shows as "{{x},{y}}" but I was wondering if it was possible to force SetterBar to show the buttons as MatrixForm[{{x},{y}}] instead? Just so it looks nicer and is easier to read for vectors with more elements.

Thanks!

$\endgroup$
2
$\begingroup$

You can use val -> lbl syntax for SetterBar:

SetterBar[Dynamic[vAwG], Thread[# -> MatrixForm /@ #] & @ vAwGOptns, 
  FrameMargins -> 15]

enter image description here

$\endgroup$

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.