Linking two editfields in GUIDE

1 次查看(过去 30 天)
I am creating a logic gate simulator using GUIDE in matlab. The logic gates are placed in static positions and the inputs/outputs for the respective gates are entered into editfields. I have to link the inputs and output to complete the circuit, therefore I have to have the user link the two editfields. I was able to use imline() in the GUI, which allows the user to draw a line between the points. But how do I interpret which inputs and outputs are connected?

采纳的回答

Bhargavi Maganuru
Bhargavi Maganuru 2020-2-14
You can add a push button for logic gate and write a callback for this button.
For example, for AND gate you can use 3 edit boxes (2 for inputs and 1 output) and push button for AND gate and add following code in the push button callback:
if editfield1.Value == editfield2.Value
if editfield1.Value == 1
editfield3.Value == "1"
else
editfield3.Value == "0"
end
else
editfield3.Value == "0"
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by