Filter löschen
Filter löschen

I want to make a GUI in which only those functions run whose radio button is on, but how to make it?

2 Ansichten (letzte 30 Tage)
Suppose I have 5 differential equations, but I only want to run and plot those, whose radio button is set 'on', and it's important that
more radio button can be selected at once. Do you guys have an idea how to make it? Thank you in advance!

Antworten (1)

Yongjian Feng
Yongjian Feng am 3 Dez. 2021
Bearbeitet: Yongjian Feng am 3 Dez. 2021
Radio buttons or checkboxes?
You can have a figure with multiple plots. Say if you have 10 checkboxes, then put 10 plots in the figure. All XData and YData set to empty, then none of them will be shown.
Once the user selects the checkbox/radio button, then you update the XData and YData of the corresponding plot to the data from the corresponding equation.
  2 Kommentare
Jani
Jani am 3 Dez. 2021
Well I'm not really sure which I should use in this case, radiobutton or checkbox.
I want to write a code which tells that if the radiobutton is selected, then execute the function under it.
Yongjian Feng
Yongjian Feng am 3 Dez. 2021
Bearbeitet: Yongjian Feng am 3 Dez. 2021
If you use CheckBox, a CheckBoxValueChanged callback function can be added to each checkbox. You can just right click on a CheckBox and select Callbacks->Add ValueChangedFcn callback from the Design View. A function like this will be automatically generated for a CheckBox:
function Showfunciton1CheckBoxValueChanged(app, event)
value = app.Showfunciton1CheckBox.Value;
end
By looking at the value, you shall be able to tell whether user selected or de-selected the checkbox.
Then you just need to show multiples plot using an UIAxes accordingly, following this link:

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Interactive Control and Callbacks 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