Linking two editfields in GUIDE

1 Ansicht (letzte 30 Tage)
vedesh Mohit
vedesh Mohit am 4 Feb. 2020
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?

Akzeptierte Antwort

Bhargavi Maganuru
Bhargavi Maganuru am 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

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by