MATLAB App designer for GUI
5 views (last 30 days)
Show older comments
Hi all,
I am newbie in MATLAB. Currently using MATLAB App designer for create a graphical user interface and fuzzy logic. I need to develope a GUI to easy assess the sustainability performance for my product. The calculation already made using fuzzy logic designer in MatlabApps. Also, I already create the design for my GUI using GUIDE by MatlabApp designer. Then, I would like to insert the coding from fuzzy logic to my GUI, my GUI will works when user insert certain value then when the user click on the button, all the final value will be auto calculate. I know that we need to use callback, since I am a new user I don't know how to enter the coding into the callback. Can I just copy and paste all the coding from my fuzzy logic into my GUI coding? But i really stuck on how to do that
Would someone could give me some hints how I am able to achieve this? Many thanks.
Best regards,
Ainina
2 Comments
Jon
on 4 Oct 2023
There are many references in the MATLAB documenation that describe the use and implementation of callbacks in App Designer. Here is one to get started https://www.mathworks.com/help/matlab/creating_guis/write-callbacks-for-gui-in-app-designer.html
Voss
on 4 Oct 2023
"Can I just copy and paste all the coding from my fuzzy logic into my GUI coding?"
Maybe. Try it and see what happens.
Accepted Answer
Dheeraj
on 20 Oct 2023
Hi,
I understand that you are trying to create callback to use in your GUI that implements your fuzzy logic. You can’t just copy paste your fuzzy logic code to create a callback, to create callback functions for the specific GUI components that you want to trigger the fuzzy logic calculations. For example, if you want the calculations to occur when a user clicks a button, you'll create a callback for that button.
Here is a simple example to demonstrate assuming you have 2 inputs for the GUI component, and you have a function named “FuzzyLogic” implemented.
function ImplementFuzzyLogic(app, event)
% Get input values from the GUI components (e.g., edit fields)
input1 = app.InputField1.Value;
input2 = app.InputField2.Value;
% Call your fuzzy logic function with the input values
result = YourFuzzyLogicFunction(input1, input2);
end
In this way you could use callbacks to implement your fuzzy logic. You can also find more about callbacks in the MATLAB’s documentation below. https://www.mathworks.com/help/matlab/creating_guis/write-callbacks-for-gui-in-app-designer.html
Hope this helps.
0 Comments
More Answers (0)
See Also
Categories
Find more on Fuzzy Logic in Simulink 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!