我试图用一个例子来创建一个新的触发器。我无法操纵整个代码。我想选择Qn1,Qn2,Qn3,Qn4来创建数组,两个表和两个表达式。当我更改Qn1,Qn2,Qn3,Qn4的选择时,我无法更改数组,表和表达式..我如何操作整个代码?这是我的代码..
XXX = {0, 0, 1, 1};
YYY = {0, 1, 0, 1};
γ[exp_] := Graphics[Text[exp], ImageSize -> {38, 48}];
z = γ[0]; o = γ[1]; b = γ[""];
δ[exp_] := Graphics[Text[exp], ImageSize -> {108, 48}];
Manipulate[
{Pinak = {XXX, YYY,
Qnand1 = {Fst = Qn1, Secd = Qn2, Trd = Qn3, Fth = Qn4}} }
, {Qn1, {0, 1}, ControlType -> SetterBar}, {Qn2, {0, 1},
ControlType -> SetterBar}, {Qn3, {0, 1},
ControlType -> SetterBar}, {Qn4, {0, 1}, ControlType -> SetterBar}]
tbl = Part[Table[IntegerDigits[n, 2, 3], {n, 0, 7}]];
Do[AppendTo[Part[tbl, i],
Part[Table[
v, {v, {Qnand1[[1]], Qnand1[[1]], Qnand1[[2]], Qnand1[[2]],
Qnand1[[3]], Qnand1[[3]], Qnand1[[4]], Qnand1[[4]]}}], i]], {i,
1, 8}];
Do[AppendTo[Part[tbl, i],
Part[Table[
v, {v, {Qnand1[[1]], Qnand1[[1]], Qnand1[[2]], Qnand1[[2]],
Qnand1[[3]], Qnand1[[3]], Qnand1[[4]], Qnand1[[4]]}}], i]], {i,
1, 8}];
Do[AppendTo[Part[tbl, i],
Part[Table[
v, {v, {! Qnand1[[1]], ! Qnand1[[1]], ! Qnand1[[2]], !
Qnand1[[2]], ! Qnand1[[3]], ! Qnand1[[3]], ! Qnand1[[4]], !
Qnand1[[4]]}}], i]], {i, 1, 8}];
tbl = Insert[
tbl, {γ[X], γ["Y"], γ[Subscript[Q, n]], γ[Subscript[Q, n + 1]],
γ["S"], γ["R"]}, 1];
If[tbl[[3, 3]] == tbl[[3, 4]] == 1, tbl[[3, 5]] = "X", Print[""]];
If[tbl[[5, 3]] == tbl[[5, 4]] == 1, tbl[[5, 5]] = "X", Print[""]];
If[tbl[[7, 3]] == tbl[[7, 4]] == 1, tbl[[7, 5]] = "X", Print[""]];
If[tbl[[9, 3]] == tbl[[9, 4]] == 1, tbl[[9, 5]] = "X", Print[""]];
If[tbl[[2, 3]] == tbl[[2, 4]] == 0, tbl[[2, 6]] = "X", Print[""]];
If[tbl[[4, 3]] == tbl[[4, 4]] == 0, tbl[[4, 6]] = "X", Print[""]];
If[tbl[[6, 3]] == tbl[[6, 4]] == 0, tbl[[6, 6]] = "X", Print[""]];
If[tbl[[8, 3]] == tbl[[8, 4]] == 0, tbl[[8, 6]] = "X", Print[""]];
aaaaaaa = {{tbl[[2, 5]], tbl[[3, 5]], tbl[[4, 5]],
tbl[[5, 5]]}, {tbl[[6, 5]], tbl[[7, 5]], tbl[[8, 5]],
tbl[[9, 5]]}};
aaaaaaab = {{tbl[[2, 6]], tbl[[3, 6]], tbl[[4, 6]],
tbl[[5, 6]]}, {tbl[[6, 6]], tbl[[7, 6]], tbl[[8, 6]],
tbl[[9, 6]]}};
If[aaaaaaa[[1, 1]] == "X", aaaaaaa[[1, 1]] = 1, Print[""]];
If[aaaaaaa[[1, 2]] == "X", aaaaaaa[[1, 2]] = 1, Print[""]];
If[aaaaaaa[[1, 3]] == "X", aaaaaaa[[1, 3]] = 1, Print[""]];
If[aaaaaaa[[1, 4]] == "X", aaaaaaa[[1, 4]] = 1, Print[""]];
If[aaaaaaa[[2, 1]] == "X", aaaaaaa[[2, 1]] = 1, Print[""]];
If[aaaaaaa[[2, 2]] == "X", aaaaaaa[[2, 2]] = 1, Print[""]];
If[aaaaaaa[[2, 3]] == "X", aaaaaaa[[2, 3]] = 1, Print[""]];
If[aaaaaaa[[2, 4]] == "X", aaaaaaa[[2, 4]] = 1, Print[""]];
If[aaaaaaab[[1, 1]] == "X", aaaaaaab[[1, 1]] = 1, Print[""]];
If[aaaaaaab[[1, 2]] == "X", aaaaaaab[[1, 2]] = 1, Print[""]];
If[aaaaaaab[[1, 3]] == "X", aaaaaaab[[1, 3]] = 1, Print[""]];
If[aaaaaaab[[1, 4]] == "X", aaaaaaab[[1, 4]] = 1, Print[""]];
If[aaaaaaab[[2, 1]] == "X", aaaaaaab[[2, 1]] = 1, Print[""]];
If[aaaaaaab[[2, 2]] == "X", aaaaaaab[[2, 2]] = 1, Print[""]];
If[aaaaaaab[[2, 3]] == "X", aaaaaaab[[2, 3]] = 1, Print[""]];
If[aaaaaaab[[2, 4]] == "X", aaaaaaab[[2, 4]] = 1, Print[""]];
If[aaaaaaab[[1, 1]] == ! 0, aaaaaaab[[1, 1]] = 1, Print[""]];
If[aaaaaaab[[1, 2]] == ! 0, aaaaaaab[[1, 2]] = 1, Print[""]];
If[aaaaaaab[[1, 3]] == ! 0, aaaaaaab[[1, 3]] = 1, Print[""]];
If[aaaaaaab[[1, 4]] == ! 0, aaaaaaab[[1, 4]] = 1, Print[""]];
If[aaaaaaab[[2, 1]] == ! 0, aaaaaaab[[2, 1]] = 1, Print[""]];
If[aaaaaaab[[2, 2]] == ! 0, aaaaaaab[[2, 2]] = 1, Print[""]];
If[aaaaaaab[[2, 3]] == ! 0, aaaaaaab[[2, 3]] = 1, Print[""]];
If[aaaaaaab[[2, 4]] == ! 0, aaaaaaab[[2, 4]] = 1, Print[""]];
If[aaaaaaab[[1, 1]] == ! 1, aaaaaaab[[1, 1]] = 0, Print[""]];
If[aaaaaaab[[1, 2]] == ! 1, aaaaaaab[[1, 2]] = 0, Print[""]];
If[aaaaaaab[[1, 3]] == ! 1, aaaaaaab[[1, 3]] = 0, Print[""]];
If[aaaaaaab[[1, 4]] == ! 1, aaaaaaab[[1, 4]] = 0, Print[""]];
If[aaaaaaab[[2, 1]] == ! 1, aaaaaaab[[2, 1]] = 0, Print[""]];
If[aaaaaaab[[2, 2]] == ! 1, aaaaaaab[[2, 2]] = 0, Print[""]];
If[aaaaaaab[[2, 3]] == ! 1, aaaaaaab[[2, 3]] = 0, Print[""]];
If[aaaaaaab[[2, 4]] == ! 1, aaaaaaab[[2, 4]] = 0, Print[""]];
GraphicsGrid[tbl]
TableView[aaaaaaab]
TableView[aaaaaaa]
S = BooleanFunction[Flatten[aaaaaaa], {Y, X, Qnn}]
R = BooleanFunction[Flatten[aaaaaaab], {Y, X, Qnn}]
我可以使示例工作的唯一方法是一次又一次地评估单元格给出不同的Qn值。我非常感谢您提供的任何帮助。