How can I embed my .m file(function) in my GUI?
Show older comments
I am trying to make a GUI which can take functional inputs from the user and can plot various graphs and contours based on the input by the user. I'm not able to find some inbuilt command which I can use directly.
5 Comments
Adam
on 8 Nov 2017
Just call it from the callback of whatever button or control you want to trigger it, in the same way you would call it from anywhere else.
The Matlab help gives examples of how to get inputs from UI controls and use them in a callback.
jd fnsl
on 8 Nov 2017
OCDER
on 8 Nov 2017
It's still not clear what you want the GUI to do, or how the question is related to what you want to do.
"How can I embed my .m file in my GUI?"
Your GUI will know how to access your .m file if the .m file is in the working directory or in the matlab path. When compiling your GUI for standalone application, matlab will determine where your .m files are and "embed" them into your application to work.
To help us understand better:
- What do you mean by "functional input"? An input that is a function string or handle?
- Is the user providing a numerical value, OR, a string command that must be evaluated as a function?
- Is the user using an editable text box to input data or something else? With an editable text box, you do this :
Val = str2double(get(hObject, 'String')); %gets value in the edit text box
jd fnsl
on 8 Nov 2017
Adam
on 8 Nov 2017
Sounds like what you are expecting is a full-blown parser. I'm not aware that anything in base Matlab can handle equations written like that. Maybe the Symbolic Toolbox can.
doc fplot
can do some plotting of a function, but it needs a function handle as far as I understand, not an equation in a string.
Accepted Answer
More Answers (1)
Categories
Find more on Entering Commands 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!