Linking two editfields in GUIDE

2 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by