Linking two editfields in GUIDE

1 vue (au cours des 30 derniers jours)
vedesh Mohit
vedesh Mohit le 4 Fév 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?

Réponse acceptée

Bhargavi Maganuru
Bhargavi Maganuru le 14 Fév 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

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by