Linking two editfields in GUIDE

1 view (last 30 days)
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?

Accepted Answer

Bhargavi Maganuru
Bhargavi Maganuru on 14 Feb 2020
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

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!